Embed presentation
Downloaded 11 times





![Array Based Stack Implementation
Where should top be?
Stacks 6
12
15
5
2
3
4
stack
[0] array
What are array values?
s.push (20)
s.pop( )](https://image.slidesharecdn.com/stacks-140916124551-phpapp01/75/Stacks-6-2048.jpg)





A stack is a data structure that follows the last-in, first-out (LIFO) principle. Items are added to the top of the stack using a push operation and removed from the top using a pop operation. Stacks can be implemented using either an array or a linked list. With an array, the top index must be tracked, while with a linked list, the top is the first node in the list. Both implementations allow push and pop operations to occur in constant time.





![Array Based Stack Implementation
Where should top be?
Stacks 6
12
15
5
2
3
4
stack
[0] array
What are array values?
s.push (20)
s.pop( )](https://image.slidesharecdn.com/stacks-140916124551-phpapp01/75/Stacks-6-2048.jpg)



