implementation has one negative aspect--it must assume fixed upper boundcapacityon the ultimate size of the stack in code fragment we chose the capacity value , more or less arbitrarily an application may actually need much less space than thiswhich would waste memory alternativelyan application may need more space than thiswhich would cause our stack implementation to generate an exception as soon as client program tries to push its , st object on the stack thuseven with its simplicity and efficiencythe array-based stack implementation is not necessarily ideal fortunatelythere is another implementationwhich we discuss nextthat does not have size limitation and use space proportional to the actual number of elements stored in the stack stillin cases where we have good estimate on the number of items needing to go in the stackthe array-based implementation is hard to beat stacks serve vital role in number of computing applicationsso it is helpful to have fast stack adt implementation such as the simple array-based implementation implementing stack with generic linked list in this sectionwe explore using singly linked list to implement the stack adt in designing such an implementationwe need to decide if the top of the stack is at the head or at the tail of the list there is clearly best choice herehoweversince we can insert and delete elements in constant time only at the head thusit is more efficient to have the top of the stack at the head of our list alsoin order to perform operation size in constant timewe keep track of the current number of elements in an instance variable rather than use linked list that can only store objects of certain typeas we showed in section we would likein this caseto implement generic stack using generic linked list thuswe need to use generic kind of node to implement this linked list we show such node class in code fragment code fragment class nodewhich implements generic node for singly linked list