1.

Write an algorithm for PUSH operation in stack.

Answer»

Algorithm for PUSH operation
PUSH(STACK, TOP, SIZE, ITEM)
Step 1: if TOP >= N-1 then
PRINT “stack is overflow”
Exit
End of if
Step 2: Top = TOP + 1
Step 3: STACK[TOP] = ITEM
Step 4: Return



Discussion

No Comment Found

Related InterviewSolutions