Implementation of Stacks with Linked Lists

 

The use of Linked Lists to implement Stacks helps to avoid stack overflow. It does this by dynamically allocating the storage space when needed. Therefore, it offers more flexibilty than implementing the stack with an array.

See the code...


Implementation of Queues with Arrays

A queue is an area or line where things wait to get processed. The first in line is the first to be processed. This is called First In First Out (FIFÆ ). With a queue we must keep track of both the front on the line and the rear. Terms used for adding something to the queue and taking something out of the queue (processing) are enqueue and dequeue.