previous | index | next

Another Solution

Implement the stack as a linked list of two-cell nodes, where each node has a stack element and a pointer to the element just below it.


previous | index | next