COMP 250 Lecture Notes - Lecture 22: Binary Search Tree, If And Only If, Priority Queue

16 views7 pages

Document Summary

Queues : the first thing that goes in is the first thing that comes on. Stacks: the last thing that comes in is the first thing to come out. We"re talking about collections and just saying add or remove. With a queue (or a stack), we have the definition of which one gets removed when we remove. You think of stacks and queues in a visual sense. Priority queues are more general than normal queues. Stacks and queues are actually types of priority queues. A priority queue has a defined ordering on the elements. It can be done in an arbitrary way. When you remove, you remove the most extreme (the smallest or largest) element. So, there has to be some way of defining the ordering -- some formal/mathematical function. : a hospital waiting room has a list of people that need to be served -- the priority depends on. Real life example their urgency or when they arrived.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents

Related Questions