Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
aa:lab:sol:10 [2023/12/19 02:57] vlad.juja |
aa:lab:sol:10 [2023/12/19 11:31] (current) mihai.udubasa remove duplicate line |
||
---|---|---|---|
Line 37: | Line 37: | ||
$ c + c_1 \log n - c_1 \log 2 \le T(n) \le c + c_2 \log n - c_2 \log 2$ \\ | $ c + c_1 \log n - c_1 \log 2 \le T(n) \le c + c_2 \log n - c_2 \log 2$ \\ | ||
- | Alegem $ c, c_1, c_2 $ astfel incat $ c_1 \log 2 =< c =< c_2 \log 2 $, deci $ c - c_1 \log 2 \ge 0 $ si $ c - c_2 \log 2 \le 0 $ :\\ | + | Alegem $ c, c_1, c_2 $ astfel incat $ c_1 \log 2 \leq c \leq c_2 \log 2 $, deci $ c - c_1 \log 2 \ge 0 $ si $ c - c_2 \log 2 \le 0 $ :\\ |
$ c_1 log\ n \le c + c_1 log\ n - c_1 log\ 2 \le T(n) \le c + c_2 log\ n - c_2 log\ 2 \le c_2 log\ n $ $ => T(n) = \Theta(log\ n) $ \\ | $ c_1 log\ n \le c + c_1 log\ n - c_1 log\ 2 \le T(n) \le c + c_2 log\ n - c_2 log\ 2 \le c_2 log\ n $ $ => T(n) = \Theta(log\ n) $ \\ | ||
Line 60: | Line 60: | ||
* $ T_c(n) = 2T_c(n/2) + \log(n)$ | * $ T_c(n) = 2T_c(n/2) + \log(n)$ | ||
- | ** nu se poate aplica master deoarece f(n) este de forma $ \log n $ si $ c != \log_ba $ (deci nu e acoperit de niciunul din cele 3 cazuri) ** | + | ** nu se poate aplica master deoarece f(n) este de forma $ \log n $ si $ c \ne \log_ba $ (deci nu e acoperit de niciunul din cele 3 cazuri) ** |
Presupunem $ T(\frac n 2) = \Theta(\frac n 2) $ \\ | Presupunem $ T(\frac n 2) = \Theta(\frac n 2) $ \\ | ||
Line 76: | Line 76: | ||
Desenand arborele, obtinem unele ramuri care se termina mai repede, altele mai incet, asa ca vom incadra timpul lui T intre 2 limite, $ S_1 $ si $ S_2 $ | Desenand arborele, obtinem unele ramuri care se termina mai repede, altele mai incet, asa ca vom incadra timpul lui T intre 2 limite, $ S_1 $ si $ S_2 $ | ||
- | $ h_1 = \log_9n, h_2 = \log_{\frac 9 8}n $\\ | ||
$ h_1 = \log_9n, h_2 = \log_{\frac 9 8}n $\\ | $ h_1 = \log_9n, h_2 = \log_{\frac 9 8}n $\\ | ||