Understanding Priority Queue using Real-life Example by Ms. Vishali (AP, CSE)
Consider a situation where you have 4 assignments, as of Monday:
- Database Management Systems, due on Thursday
- Statistics, due on Tuesday
- Data Structures and Algorithms, due on Wednesday
- Operating System, due on Friday
As a student, overburdened with work, if you do first come, first serve, you might not be able to submit all your assignments on time. So instead, you assign a priority to each of them and get them done in that order. In this case:
- Database Management Systems, due on Thursday Priority Number 3
- Statistics, due on Tuesday Priority Number 1
- Data Structures and Algorithms, due on Wednesday Priority Number 2
- Operating System, due on Friday Priority Number 4