Stack Operations

Stack:

A stack is a linear data structure in which insertion of the new data element and deletion of an existing data element is done from only one end called Top of the Stack, the last inserted item will be deleted first that is why stack is also called LIFO (Last in First out) or FIFO (First in First out)

Basic Stack Operations:

1. fnInitialize(S): Initialize the stack S.

2. fnPush(S, iData): Insert the element iData on top of the stack S.

3. fnPop(S): Delete the top most item from the stack S and return the removed item.

4. fnfull(S): This function checks whether the stack S is full or not. To indicate S is full this function returns TRUE and otherwise FALSE. During the PUSH operation Full(S) condition should be checked if there is any restriction on the maximum number of elements in the stack.

5. fnEmpty(S): It is also a Boolean function and return TRUE for empty stack and FALSE for non-empty stack. During POP operation Empty(S) condition is checked.