1.6 KiB
1.6 KiB
Asymptotic Equivalence Classes (Big-O)
The equivalence relation definition given in the task is asking you to find functions that grow at the exact same rate (also known as Big-Theta \Theta):
f asymp g <==> f in O(g) and g in O(f)
Notation of f in O(g) means "function f doesn't grow faster than $g$"
The "Dominant Term" Rule
To find which class a function belongs to, simplify it to its core growth rate:
- Drop all lower-order terms: In
n^3 + n^2, drop then^2. - Drop all constant multipliers:
5n^2and1000n^2both become justn^2. - Identify the highest rank: Factorials (
n!) > Exponentials (2^n,e^n) > Polynomials (n^3,n^2) > Linear (n) > Logarithmic (log n) > Constant (1).
Euclidian Algorithm
Purpose is to find the GCD (Greatest Common Divisor).
Core Rule
Fill out this formula:
"Dividend" = ("Quotient" * "Divisor") + "Remainder"
- Divide the bigger number by the smaller one
- How many times does it fit ->
"Quotient" - Find out whats leftover ->
"Remainder" - Shift to left and repeat (
"Old Divisor" -> "Dividend","Remainder" -> "Divisor")
Result is the last "Remainder" that is not 0.
Bezout Coefficients
Goal: find a x and y so that "Divident" * x + "Divisor" * y = gcd("Dividend", "Divisor")
- Rewrite Euclid (above) equations to solve for remainder (
"Remainder" = "Old Remainder" - "Dividend" * "Divisor") - Substitute remainders
- Simplify (Final Form:
"GCD" = x * "Dividend" + "y * Divisor")
Extended Euclidian Algorithm
- Find GCD using Euclidian Algorithm