+1 vote
in Data Structures & Algorithms I by (110k points)
Which of the following array position will be occupied by a new element being pushed for a stack of size N elements(capacity of stack > N)?

(a) S[N-1]

(b) S[N]

(c) S[1]

(d) S[0]

This intriguing question originated from Stack using Array in chapter Abstract Data Types of Data Structures & Algorithms I

I had been asked this question during a job interview.

1 Answer

+1 vote
by (412k points)
selected by
 
Best answer
Right answer is (b) S[N]

Explanation: Elements are pushed at the end, hence N.

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

...