+1 vote
in Data Structures & Algorithms I by (110k points)
What is the time complexity of pop() operation when the stack is implemented using an array?

(a) O(1)

(b) O(n)

(c) O(logn)

(d) O(nlogn)

My enquiry is from Stack using Array in division Abstract Data Types of Data Structures & Algorithms I

I have been asked this question in an interview for job.

1 Answer

+1 vote
by (412k points)
selected by
 
Best answer
The correct answer is (a) O(1)

The best I can explain: pop() accesses only one end of the structure, and hence constant time.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.

Categories

...