An O(n) algorithm takes 3 seconds for n = 1 million. About how long does it take for n = 2 million?
- A6 seconds
- B9 seconds
- C3 seconds
- D12 seconds
An O(n) algorithm takes 3 seconds for n = 1 million. About how long does it take for n = 2 million?
What is a brute-force algorithm?
Which of these grows slowest as n becomes large?
What is the amortised time complexity of appending to a dynamic array that doubles its capacity when full?
In a sorted array, you look for two elements that sum to a target by moving one pointer from each end inwards. What is the time complexity?
With coins of 1, 3 and 4 and an amount of 6, how many coins does the greedy "largest coin first" method use, compared to the optimum?
Which definition of the class P is correct?
What is the running time of Dijkstra's algorithm with a binary heap on a graph with V vertices and E edges?
Full step-by-step solutions: practise this topic on examproblems.com.