ece250: add master method

This commit is contained in:
eggy 2023-12-05 15:47:32 -05:00
parent 34c1d20461
commit 0d7e78e53a

View File

@ -1,5 +1,14 @@
# 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
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$.