Please enable JavaScript.
Coggle requires JavaScript to display documents.
Stacks, Queues - Coggle Diagram
Stacks
-
-
Linked Stacks
Elements are inserted and removed only from the head of the list. A header node is not used because no special-case code is required for lists of zero or one elements.
The only data member is top, a pointer to the first link node of the stack.
Method push first modifies the next field of the newly created link node to point to the top of the stack and then sets top to point to the new link node.
The acessible element of the stack is called the top element. Elements are not said to be inserted, they are pushed onto the stack. When removed, an element is said to be popped from the stack.
-