Saturday, 6 July 2013

What is stack - peak concepts

An important subclass of lists permits the insertion and deletion of an element to occur only at one end. A linear list of this type is known as ‘stack’.

The insertion is referred to as ‘push’. The deletion is referred to as ‘pop’. The two pointers used for accessing is top & bottom pointer.
 
PUSH – Storing the element into the stack.
Check top<= allowed size if yes increment the top position and store the value in the top position.
 
POP -  Deleting the element from the stack. If top<= we can not delete.
Otherwise decrement the top by one and return the top+1 element. 


0 comments:

Post a Comment