stacks stacks areon an abstract levelequivalent to linked lists they are the ideal data structure to model first-in-last-out (filo)or last-in-first-out (lifo)strategy in search graphical representation their relation to linked lists means that their graphical representation can be the samebut one has to be careful about the order of the items for instancethe stack created by inserting the numbers [ in that order would be represented as abstract data type "stackdespite their relation to linked liststheir different use means the primitive operators for stacks are usually given different names the two constructors areemptystackthe empty stackand push(elementstack)which takes an element and pushes it on top of an existing stackand the two selectors aretop(stack)which gives back the top most element of stackand pop(stack)which gives back the stack without the top most element the selectors will work only for non-empty stackshence we need condition which tells whether stack is emptyisempty(stackwe have equivalent automatically-true relationships to those we had for the listsisempty(emptystacknot isempty(push(xs)(for any and stop(push(xs) pop(push(xs) in summarywe have the direct correspondenceslist stack constructors emptylist makelist emptystack push selectors first rest top pop condition isempty isempty sostacks and linked lists are the same thingapart from the different names that are used for their constructors and selectors