An algorithm with two nested loops, each running n times, typically has which complexity?
- AO(2n)
- BO(n²)
- CO(log n)
- DO(n)
An algorithm with two nested loops, each running n times, typically has which complexity?
What is the time complexity of finding the largest value in an unsorted array of n numbers?
What is the worst-case time complexity of insertion sort?
How much stack space does a simple recursive factorial function fact(n) = n × fact(n − 1) use?
The lower bound for comparison-based sorting in the worst case is:
You sort an array of n elements once and then answer k membership queries with binary search. What is the total cost?
Is 22n in O(2ⁿ)?
Which two things must be shown to prove that a decision problem X is NP-complete?
Full step-by-step solutions: practise this topic on examproblems.com.