Machine-translated by Google. Questions are authored in English.
Top

Discussion

The solution of recurrence relation, \(T(n) = 2T(\lfloor \sqrt{n} \rfloor) + \log n\) is

  • A.\(O(n \log \log \log n)\)
  • B.\(O(n \log \log n)\)
  • C.\(O(\log \log n)\)
  • D.\(O(\log n \log \log n)\)

Answer: D

The solution is \(O(\log n \log \log n)\), which is option (D). Put \(m = \log n\); then \(T(2^{m}) = 2T(2^{m/2}) + m\). Writing \(S(m) = T(2^{m})\) gives

\[ S(m) = 2S(m/2) + m \]

which, by the master theorem, is \(\Theta(m \log m)\). Going back to \(n\):

\[ T(n) = \Theta(\log n \log \log n) \]

The bounds with a factor n in (A) and (B) are far too large, and \(O(\log \log n)\) in (C) is too small, since the term \(\log n\) is added at the top level.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.