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

Q & ACategory: Data StructureWhat is the time complexity for inserting/deleting at the beginning of the array?
Admin Staff asked 4 years ago

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)

1 Answers
Admin Staff answered 4 years ago

b) O(n)