there are two different ways we can think about implementing stacks so far we have implied functional approach that ispush does not change the original stackbut creates new stack out of the original stack and new element that isthere are at least two stacks aroundthe original one and the newly created one this functional view is quite convenient if we apply top to particular stackwe will always get the same element howeverfrom practical point of viewwe may not want to create lots of new stacks in programbecause of the obvious memory management implications instead it might be better to think of single stack which is destructively changedso that after applying push the original stack no longer exitsbut has been changed into new stack with an extra element this is conceptually more difficultsince now applying top to given stack may give different answersdepending on how the state of the system has changed howeveras long as we keep this difference in mindignoring such implementational details should not cause any problems queues queue is data structure used to model first-in-first-out (fifostrategy conceptuallywe add to the end of queue and take away elements from its front graphical representation queue can be graphically represented in similar way to list or stackbut with an additional two-cell in which the first element points to the front of the list of all the elements in the queueand the second element points to the last element of the list for instanceif we insert the elements [ into an initially empty queuewe get this arrangement means that taking the first element of the queueor adding an element to the back of the queuecan both be done efficiently in particularthey can both be done with constant efforti independently of the queue length abstract data type "queueon an abstract levela queue can be constructed by the two constructorsemptyqueuethe empty queueand push(elementqueue)which takes an element and queue and returns queue in which the element is added to the original queue at the end for instanceby applying push( qwhere is the queue abovewe get