Which of these running times is polynomial?
- AO(2ⁿ)
- BO(nⁿ)
- CO(n³)
- DO(n!)
Which of these running times is polynomial?
An algorithm with two nested loops, each running n times, typically has which complexity?
Which sorting algorithm repeatedly swaps adjacent elements that are in the wrong order?
You sort an array of n elements once and then answer k membership queries with binary search. What is the total cost?
What is the time complexity of the Bellman–Ford algorithm on a graph with V vertices and E edges?
How much stack space does a simple recursive factorial function fact(n) = n × fact(n − 1) use?
What does the recurrence T(n) = 2T(n/2) + n log n solve to?
For which knapsack variant does the greedy rule "take items in order of value per weight" always give an optimal answer?
Full step-by-step solutions: practise this topic on examproblems.com.