Data Structure: Unit II (a): Stacks

Stack ADT

Operations | Data Structure

Stack is a data structure which posses LIFO i.e. Last In First Out property.

Stack ADT

• Stack is a data structure which posses LIFO i.e. Last In First Out property.

• The abstract data type for stack can be as given below.

AbstractDataType stack

{

Instances: Stack is a collection of elements in which insertion and deletion of elements is done by one end called top.

Preconditions:

1. Stfull (): This condition indicates whether the stack is full or not. If the stack is full then we cannot insert the elements in the stack.

2. Stempty(): This condition indicates whether the stack is empty or not. If the stack is empty then we cannot pop or remove any element from the stack.

Operations:

1. Push:  By this operation one can push elements onto the stack. Before performing push we must check stfull () condition.

2. Pop :  By this operation one can remove the elements from stack. Before popping the elements from stack we should check stempty () condition.

Data Structure: Unit II (a): Stacks : Tag: : Operations | Data Structure - Stack ADT