[Solved] What is the time complexity for inserting/deleting at the beginning of the array?

What is the time complexity for inserting/deleting at the beginning of the array?

a) O(1)
b) O(n)
c) O(logn)
d) O(nlogn)

Answer: b
Explanation: All the other elements will have to be moved, hence O(n).

Comments