forked from eggy/eifueo
ece250: add master method
This commit is contained in:
parent
34c1d20461
commit
0d7e78e53a
@ -1,5 +1,14 @@
|
|||||||
# ECE 250: DSA
|
# ECE 250: DSA
|
||||||
|
|
||||||
|
## Solving recurrences
|
||||||
|
|
||||||
|
The **master method** is used to solve recurrences. For expressions of the form $T(n)=aT(n/b)+f(n)$:
|
||||||
|
|
||||||
|
- If $f(n)=O(n^{\log_b a})$, we have $T(n)=\Theta(n^{\log_b a}\log n)$
|
||||||
|
- If $f(n) < O(n^{\log_b a})$, we have $T(n)=O(n^{\log_b a})$
|
||||||
|
- If $f(n) > \Omega(n^{\log_b a})$, and $af(n/b)\leq cf(n), c<0$, we have $T(n)=\Theta(f(n))$
|
||||||
|
|
||||||
|
|
||||||
## Heaps
|
## Heaps
|
||||||
|
|
||||||
A heap is a binary tree **stored in an array** in which all levels but the lowest are filled. It is guaranteed that the parent of index $i$ is greater than or equal to the element at index $i$.
|
A heap is a binary tree **stored in an array** in which all levels but the lowest are filled. It is guaranteed that the parent of index $i$ is greater than or equal to the element at index $i$.
|
||||||
|
Loading…
Reference in New Issue
Block a user