COMPENG 2SI4 Lecture 2: Math Review and Binary Search

35 views3 pages
user avatar
Published on 7 Feb 2017
School
McMaster University
Department
Computer Engineering
Course
COMPENG 2SI4
Math Review
Permutations
Ordered arrangement of a number of objects
If there are n distinct elements there are n! Permutations
Modular Arithmetic
The modulus function returns the remainder after dividing two integer
Say we have 10 modulo 8 → this gives an answer of 2
In java this operation is written as 10%8
Arithmetic and Geometric Series
These series are good to know
Harmonic Series
The above series diverges as n goes to infinity but it can be shown that:
And therefore we can say that the series diverges logarithmically as n approaches infinity
Sum of Consecutive Numbers Raised to the Same Power
Unlock document

This preview shows page 1 of the document.
Unlock all 3 pages and 3 million more documents.

Already have an account? Log in

Document Summary

Ordered arrangement of a number of objects. If there are n distinct elements there are n! The modulus function returns the remainder after dividing two integer. Say we have 10 modulo 8 this gives an answer of 2. In java this operation is written as 10%8. The above series diverges as n goes to infinity but it can be shown that: And therefore we can say that the series diverges logarithmically as n approaches infinity. Sum of consecutive numbers raised to the same power. Given an array of elements that is already in memory. Given a search key that is of the same type as the elements in the array. Find the element in the array, if any, that matches the search key. Compare the search key to each element in the array. Move sequentially from the beginning towards the end. Continue to iterate through the loop until a match is found or the array has ended.