Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
aa:lab:10 [2023/12/17 20:53] mihai.udubasa changed 1.3 |
aa:lab:10 [2025/01/23 14:10] (current) dmihai |
||
---|---|---|---|
Line 7: | Line 7: | ||
</note> | </note> | ||
*/ | */ | ||
+ | |||
+ | <note important> | ||
+ | Teorema Master se poate aplica pe recurente de forma: | ||
+ | |||
+ | * $ T(n) = a * T(\frac n b) + f(n); a \ge 1; b > 1 $ | ||
+ | |||
+ | In functie de $ f(n) $ apar urmatoarele cazuri: | ||
+ | - $ f(n) = \Theta(n^c) ; c < \log_ba $ $ \Rightarrow T(n) = \Theta(n^{\log_ba}) $ | ||
+ | - $ f(n) = \Theta(n^c * \log^kn); k \geq 0; c = \log_ba $ $ \Rightarrow T(n) = \Theta(n^{\log_ba}*\log^{k+1}n) $ | ||
+ | - $ f(n) = \Theta(n^c); c > \log_ba $ $ \Rightarrow T(n) = \Theta(f(n)) $ | ||
+ | </note> | ||
+ | |||
+ | |||
1. Folosiți Teorema Master pentru a rezolva următoarele recurențe: | 1. Folosiți Teorema Master pentru a rezolva următoarele recurențe: | ||
Line 57: | Line 70: | ||
* $ T_d(n) = T_d(n/9) + T_d(8n/9) + n$ | * $ T_d(n) = T_d(n/9) + T_d(8n/9) + n$ | ||
* $ T_e(n) = T_e(2n/3) + 1$ | * $ T_e(n) = T_e(2n/3) + 1$ | ||
- | * $ T_{Strassen}(n) = 7T_{Strassen}(n/2) + n^2 $ | + | * $ T_{Strassen}(n) = 7T_{Strassen}(n/2) + n^2 $\\ |
- | * $ T_{Karatsuba}(n) = 3T_{Karatsuba}(n/2) + 1 $ | + | Aceasta recurenta descrie [[https://en.wikipedia.org/wiki/Strassen_algorithm| Algoritmul Strassen]] |
- | * $ T_{Quicksort}(n) = T_{Quicksort}(n-1) + O(n) $ | + | * $ T_{Karatsuba}(n) = 3T_{Karatsuba}(n/2) + 1 $\\ |
+ | Aceasta recurenta descrie [[https://en.wikipedia.org/wiki/Karatsuba_algorithm| Algoritmul Karatsuba]] | ||
+ | * $ T_{Quicksort}(n) = T_{Quicksort}(n-1) + O(n) $\\ | ||
+ | Aceasta recurenta descrie [[https://en.wikipedia.org/wiki/Quicksort| Algoritmul Quicksort]] | ||
4. Rezolvați următoarea recurență folosind metoda substituției: $math[T(n) = 2 T(\frac{n}{2}) + 1]. | 4. Rezolvați următoarea recurență folosind metoda substituției: $math[T(n) = 2 T(\frac{n}{2}) + 1]. | ||
5. Rezolvați următoarea recurență folosind metoda arborilor: $math[T(n) = T(] $math[n \over 4] $math[) + T(] $math[3n \over 4] $math[) + n]. | 5. Rezolvați următoarea recurență folosind metoda arborilor: $math[T(n) = T(] $math[n \over 4] $math[) + T(] $math[3n \over 4] $math[) + n]. | ||
+ | |||
+ | |||
+ | <note> | ||
+ | Soluțiile acestui laborator se găsesc [[https://ocw.cs.pub.ro/ppcarte/doku.php?id=aa:lab:sol:10|aici]] | ||
+ | </note> |