stack operation stack contents return value is_empty( push( push('dog' peek( push(trues size( is_empty( push( pop( pop( size([[ [ ,'dog'[ ,'dog'[ ,'dog',true[ ,'dog',true[ ,'dog',true[ ,'dog',true, [ ,'dog',true[ ,'dog'[ ,'dog'true 'dog false true table sample stack operations you use your computer for exampleevery web browser has back button as you navigate from web page to web pagethose pages are placed on stack (actually it is the urls that are going on the stackthe current page that you are viewing is on the top and the first page you looked at is at the base if you click on the back buttonyou begin to move in reverse order through the pages the stack abstract data type the stack abstract data type is defined by the following structure and operations stack is structuredas described aboveas an ordered collection of items where items are added to and removed from the end called the "top stacks are ordered lifo the stack operations are given below stack(creates new stack that is empty it needs no parameters and returns an empty stack push(itemadds new item to the top of the stack it needs the item and returns nothing pop(removes the top item from the stack it needs no parameters and returns the item the stack is modified peek(returns the top item from the stack but does not remove it it needs no parameters the stack is not modified is_empty(tests to see whether the stack is empty it needs no parameters and returns boolean value size(returns the number of items on the stack it needs no parameters and returns an integer for exampleif is stack that has been created and starts out emptythen table shows the results of sequence of stack operations under stack contentsthe top item is listed at the far right basic data structures