Coders Packet

Max priority queue using Python

By Patnam Venkata Koushik

Implementation of the max priority queue and providing some functions such as getting length, inserting and deletion using Python

In this Python project, we implement the class for Max Priority Queue which includes the following Python functions. Priority queue is an abstract data type similar to stack data structure in addition to providing a priority for each value that is entered into a stack. The operations are similar to that of a stack data structure. The below-mentioned functions can be performed on the priority queue.

  1. getSize -

This function will return the size of the priority queue or it will give the number of elements present in the queue.

  1. isEmpty -

This function will return a true or false value for whether the following priority queue is empty or not. In other terms, it will return true or false for whether a queue's size is zero or not

  1. insert -

This function is used to insert the values into the queue along with the priority mentioned.

  1. getMax -

This function is used to get the maximum value of the queue and in case if the queue is empty, then it will return infinity.

  1. removeMax -

This function is used to find out the maximum value using 'getMax' and then delete the value from the queue. If the queue is empty, then it will return infinity

 

Download Complete Code

Comments

No comments yet