Stack Module: Double-Ended Stacks
A double-ended stack is essentially a pair of stacks that share a fixed amount of storage (memory). The two stacks are designed so that the top of stack of each begins at each end of a list structure. Each top of stack moves towards the other when an element is pushed, as depicted below. This stack implementation has the advantage of more effectively utilizing a fixed amount of memory than if each stack were allocated its own storage.
Modify and test the stack module to behave as a double-ended stack.
No comments:
Post a Comment