Stack
Algorithm
Push an element
- 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
Program
Output
|