Professional Documents
Culture Documents
Stack
Stack
Stack
2)Pop(Top,stack_arr)
Let(1)”Top” be any integer datatype initialized with -1 value.
(2)let stack_arr is the name of the array.
STEP 1:BEGIN
STEP 2:if top=-1[if the value of top is equal to -1] then
(1) the stack is underflow.
END IF
STEP 3:ELSE
(1)display the array of top value[the value deleted is,stack_arr[top]]
(2)top-1[decrease the value of top by 1]
END ELSE
STEP 4:return Top
STEP 5:STOP
3)Display(top,I,stack_arr)
Let (1)”Top” be any integer datatype initialized with -1 value.
(2)i is the integer executed in loop structure.
STEP 1:BEGIN
STEP 2: While I>=0 [until the value of I is greater then or equal to 0]
I=Top [assign the value of top to i[i=Top]
And (I-1)[decrease the value of I by 1]
Write the value of stack_arr[I]
END LOOP
STEP 3:STOP