An algorithm with two nested loops, each running n times, typically has which complexity?
- AO(n²)
- BO(2n)
- CO(n)
- DO(log n)
An algorithm with two nested loops, each running n times, typically has which complexity?
A loop starts with i = 1 and doubles i each iteration until i > n. How many iterations does it run?
An O(n) algorithm takes 3 seconds for n = 1 million. About how long does it take for n = 2 million?
What does the recurrence T(n) = T(n − 1) + O(n) solve to?
What is the time complexity of multiplying two n × n matrices with the standard triple loop?
How much stack space does a simple recursive factorial function fact(n) = n × fact(n − 1) use?
What is the time complexity of building a binary heap from n unsorted elements with the bottom-up method?
Why does binary search not give O(log n) time on a singly linked list?
Full step-by-step solutions: practise this topic on examproblems.com.