Edit this page Backlinks This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Soluții Laboratorul 6 ====== 1. a. binary_search: După verificările realizate în timp constant, problema este împărțită în două subprobleme de dimensiune înjumătățită, din care doar una este aleasă. \\ $ T(n) = T(n/2) + 1, T(1) = 1 $ Metoda arborilor: WIP Metoda substituției: \\ Vrem sa demonstrăm că $ T(n) = \Theta(n) $, adică \\ $ \exists(c_1, c_2 > 0)(N \geq 0): \forall(n\geq N): c_1 \log n \leq T(n) \leq c_2 \log n $ Cazul de bază: \\ $ N = 2 $ \\ $ c_1 \log 2 = c_1 \leq T(2) = 1 + 1 = 2 \leq c_2 \log 2 = c_2 \Rightarrow $ \\ $ c_1 \leq 2 $ \\ $ c_2 \geq 2 $ Pasul inducției: \\ pp. că $ c_1 \log(n/2) \leq T(n/2) \leq c_2 \log(n/2) $ \\ $ \Rightarrow c_1 \log(n/2) + 1 \leq T(n/2) + 1 \leq c_2 \log(n/2) + 1 $ \\ $ \Rightarrow c_1 \log n - \log 2 + 1 \leq T(n) \leq c_2 \log n - \log 2 + 1 $ \\ $ \Rightarrow c_1 \log n \leq T(n) \leq c_2 \log n $