1.

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)Question is from Dynamic Array in section Arrays Types of Data Structures & Algorithms II had been asked this question in quiz.

Answer» CORRECT OPTION is (b) O(n)

Easiest EXPLANATION - All the other ELEMENTS will have to be moved, hence O(n).


Discussion

No Comment Found

Related InterviewSolutions