Stack

 

 

The Stack ADT

 

A stack is a list with the restriction that inserts and deletes can be performed in only one position, namely the end of the list called the top. The fundamental operations on a stack are

1.   Push – insert an element

2.   Pop – deletes the most recently inserted element but does not display / return the element

3.   Top – returns the value of the most recent element inserted into the stack, but does not delete the element from the stack.

4.   TopAndPop – returns the value of the most recently inserted element and also deletes the element from the stack.

5.   Other operations include checking for empty stack, making the stack empty and disposing the stack.

Stack Model

 

Stack Model


 


 

No comments:

Post a Comment

Don't be a silent reader...
Leave your comments...

Anu