Question DSA-CX-0008
EasyWhich complexity describes an algorithm that halves the problem size at every step?
- A.
O(n²)
- B.
O(log n)
- C.
Show answer and explanation
Answer: B
Halving n repeatedly reaches 1 after about log₂ n steps.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Complexity Analysis question
Which complexity describes an algorithm that halves the problem size at every step?
O(n²)
O(log n)
Answer: B
Halving n repeatedly reaches 1 after about log₂ n steps.
O(1)
O(n)