Priority Queue Readme
Priority Queue:
A priority queue is a queue that arranges the elements based on the priority of the elements.
Elements with higher priority values are typically retreived before elements with lower priority values.
In a priority queue each element has a priority queue associated with it. When you add an element in a queue it is inserted in a position based on it's priority value.
If you add an element with a higher priority value to priority queue, it may be inserted near the front of the queue. Element with lower priorty valued inserted at back
There are several ways to implement a priority queue, including using an array, linkedlist, heap, or binary serach tree.
Each method has its own advantages and disadvantages.
Priority Queues are often used in real-time systems, where the order in which elements are processed can have significant consequences. They are also used in algorithms to improve their efficiencies, such as Dijkstra's algorithm for finding the shortest path in a graph. A* search algorithm for pathfinding.
If two elemnets have the same priority, they are served according to their order in the queue.
How priority is assigned to the elements in a Priority Queue?
In a priority queue, generally, the value of an element is considered for assigning the priority.