Sunday, July 18, 2010

Psudo codes for function PUSH & POP

Psudo code for function "push" :-
    1)  Check  the condition for over flow. 
      2)   If stack is full then print the appropriate message and return.
      3)  If stack is not full then increase 'tos' by 1. 
      4) Place the element at the position pointed by 'tos' .
     

Psudo code for function "pop"  :-
      1) Check the condition for under flow.
      2) If  stack is empty then print the message "stack under flow"  and return with appropriate error
            message.

      3) Remove the element pointed by 'tos'.
        4)  Decrement 'tos' by 1.
        5)  Return the removed element.

   

No comments:

Post a Comment