What does it mean if an operation runs in O(1) time?
- AIt always takes exactly one second
- BIts running time does not grow with the input size
- CIt can only be run once
- DIt processes exactly one element per second of running time
What does it mean if an operation runs in O(1) time?
What is the best-case time complexity of insertion sort, on an already sorted array?
What is the worst-case time complexity of merge sort?
Dynamic programming is useful when a problem has:
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?
A function runs one loop of n iterations and then, separately, another loop of n iterations. What is its time complexity?
Which algorithm finds a minimum spanning tree by repeatedly adding the cheapest edge that does not form a cycle?
Which bound is correct for log(n!)?
Full step-by-step solutions: practise this topic on examproblems.com.