What is the worst-case time complexity of inserting an element at the beginning of an array of n elements?
- A O(1)
- B O(log n)
- C O(n)
- D O(n log n)
Explanation
All n existing elements must be shifted one position to the right to make room, so insertion at the start costs O(n).