Operation on Stack


1)push:

Adds an item to the stack. If the stack is full, then it is said to be an Overflow condition.

STEP 1: START
STEP 2: Store the element to push into array
STEP 3: Check if top== (MAXSIZE-1) then stack is full else goto step 4
STEP 4: Increment top as top = top+1
STEP 5: Add element to the position stk[top]=num
STEP 6: STOP


DS push

1)pop:

Removes an item from the stack. The items are popped in the reversed order in which they are pushed. If the stack is empty, then it is said to be an Underflow condition.

STEP 1: START
STEP 2: Store the element to push into array
STEP 3: Check if top== (MAXSIZE-1) then stack is full else goto step 4
STEP 4: Increment top as top = top+1
STEP 5: Add element to the position stk[top]=num
STEP 6: STOP


no image

Footer Design