1.

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 II had been asked this question during a job interview.

Answer»

Right ANSWER is (B) S[N]

Explanation: ELEMENTS are pushed at the end, HENCE N.



Discussion

No Comment Found

Related InterviewSolutions