Chapter 1: Problem 28
What is the time complexity \(T(n)\) of the nested loops below? For simplicity, you may assume that \(n\) is a power of \(2 .\) That is, \(n=2^{k}\) for some positive integer \(k\) : \\[ \begin{array}{l} i=n_{i} \\ \text { while }(i>=1)\\{ \\ \qquad \begin{array}{c} j=i \\ \text { while }(j<=n) \end{array} \end{array} \\] < body of the inner while loop> \(\quad\) I/ Needs \(\Theta(1)\) \\[ j=2^{*} j \\] } \\[ i=|1 / 2| \\] }
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.