Question DSA-CX-0032
EasyWhat is the time complexity of this loop: for (i = 1; i < n; i = i * 2)?
- A.
O(n²)
- B.
O(n)
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Complexity Analysis question
What is the time complexity of this loop: for (i = 1; i < n; i = i * 2)?
O(n²)
O(n)
Sign up free to see the answer and a step-by-step explanation.
O(1)
O(log n)