next up previous
Next: Example: Factorial Up: l2 Previous: Now let's try subtracting

Changing Variables



Example: T(n) = 2T($\sqrt{n}$) + lg n



Let \(m = lg n, \;\; 2^m = n, \;\; n^{1/2} \;=\; (2^m)^{1/2} \;=\; 2^{m/2}\)
\(T(2^m) \;\; = \;\; 2T(2^{m/2}) \; + \; m\)



Let \(S(m) \;\;=\;\; T(2^m) \;\;=\;\; T(n)\)
\(S(m) \;\;=\;\; 2S(m/2) + m\)
\(S(m) \;\;=\;\; O(mlgm)\)
\(T(n) \;\;=\;\; O(mlgm) \;\;=\;\; O(lgn \;lglgn)\)


next up previous
Next: Example: Factorial Up: l2 Previous: Now let's try subtracting