Image
Top
Navigation
November 20, 2012

Data Structures – manual stack and queue configuration

A Stack class for storing integers. It uses an internal array  and implements the push, pop and empty operations as methods. The second class, Queue, uses two internal stacks and uses the enqueue, dequeue and empty operations as methods.

The Queue class makes use of the Stack class to transform a stack into a queue and retrieve the FIFO item (first in first out).

 

 

Posted By

Categories

Python