Skip to main content

Queues implementation using Python

Queue : A queue is a collection of objects in which elements are added/deleted based on the principle of FIFO (First In First Out)

Queue ADT :-
Q.enqueue(e) : Add an element to the end
Q.dequeue()  : Remove and return the first element, an error will be reported if empty
Q._front()   : Returns the first element without removing it, an error will be reported if empty
Q.isEmpty()  : Returns True if the Queue is empty
Q.isFull()   : Returns True if the Queue is full
Q.size()     : Returns the length of Queue

Implementation :
Queue will be implemented using Lists (circular arrays), where we assume that the Queue is of fixed size N

Test Code

Comments