Course Data Structures Essentials
Priority Queue
Hello again ๐. In this class, you will learn about Priority Queue and its main functions.
- Introduction to Priority Queue
- When to use Priority Queue?
- Priority Queue in C++
- Priority Queue in Python
Introduction
The Priority Queue is a slightly different data structure than the others presented so far. It always keeps in first position the biggest stored element, note that, the structure does not keep the elements ordered, it only guarantees that the first element is the biggest.
It is important to point out that, in this class, we will not pay attention to the internal details of how it works or how the functions of this structure are implemented. We will omit these details and then return to it in a future course.
When to use Priority Queue?
We usually use Priority Queues to implement Algorithms, when it is necessary to efficiently obtain the biggest element, that allows the optimization of a solution to some problem. This way Pirority Queue are applied in algorithms like:
- The Dijkstra Minimum Path Algorithm in graphs.
- The Prim Algorithm for Minimal Spanning Tree in graphs.