Computer Science, asked by tinnixyz123, 7 months ago

Q1. Consider the following stack of size 5. Top=2.
Stack: Delhi, Kolkatta, Patiala.
Describe the stack when the following operations take place:
a. Chandigarh is pushed
b. Ahmedabad is pushed
c. Pop the element
d. Chennai is pushed
e. Lucknow is pushed
f. Pop the element..plz give correct answer..​

Answers

Answered by waizuwolf
0
  • a) Chandigarh gets added and is on top.
  • b) Ahemdabad gets added and is on top.
  • c) Ahemdabad gets popped out, Chandigarh is on top.
  • d) Chennai gets added and is on top.
  • e) Stack overflow since max size is 5 and stack is at full capacity.
  • f) Chennai gets popped, Chandigarh is on top.

Similar questions