From the course: Python Data Structures and Algorithms
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Understand the priority queue data structure - Python Tutorial
From the course: Python Data Structures and Algorithms
Understand the priority queue data structure
- [Instructor] A priority queue is useful in any situation where there are resources needed to be allocated according to some rule or rules of precedence. A classic example is allocation of healthcare resources in a hospital, where the severity of patient's medical needs determines their level of priority. The slide shows some applications of priority queues. This should give you an idea of how useful the data structure is. So they're used a lot in artificial intelligence, including the A* algorithm, which we're going to be studying shortly. Priority queues are used in optimization algorithms. They're used a lot in operating systems with process scheduling. Used, for example, also in bandwidth management, statistical analysis, and spam filtering. So those are just some examples of how useful this data structure is. Now the main operations for a priority queue are get. And that is to retrieve an item with the highest priority, so that's similar to DQ in a queue. Except it's not just to…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.