Exploring a possible solution


Now that we know that storing priorities in a linked list has limitations and results in sub-optimal solutions, we can look at a data structure explicitly designed to solve this problem. A priority queue is a data structure designed to keep track of the maximum or minimum of a continuously changing dataset.

What is a priority queue?

A priority queue is a specialized data structure that stores data items with associated priorities. Like a regular queue, data can only be added at the end and extracted from the front.

Liking the course? Check our discounted plans to continue learning.