{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

PriorityQueues

# PriorityQueues - Priority Queues 2:03 AM Priority Queues...

This preview shows pages 1–3. Sign up to view the full content.

Priority Queues 1/27/2005 2:03 AM 1 1/27/2005 2:03 AM Priority Queues 1 Priority Queues \$118 IBM 400 Buy \$119 IBM 500 Buy IBM IBM \$120 300 Sell \$122 100 Sell 1/27/2005 2:03 AM Priority Queues 2 Outline and Reading PriorityQueue ADT (§2.4.1) Total order relation (§2.4.1) Comparator ADT (§2.4.1) Sorting with a priority queue (§2.4.2) Selection-sort (§2.4.2) Insertion-sort (§2.4.2)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Priority Queues 1/27/2005 2:03 AM 2 1/27/2005 2:03 AM Priority Queues 3 Priority Queue ADT A priority queue stores a collection of items An item is a pair (key, element) Main methods of the Priority Queue ADT insertItem (k, o) inserts an item with key k and element o removeMin () removes the item with smallest key and returns its element Additional methods minKey () returns, but does not remove, the smallest key of an item minElement () returns, but does not remove, the element of an item with smallest key size (), isEmpty () Applications: Standby flyers Auctions Stock market 1/27/2005 2:03 AM Priority Queues 4 Total Order Relation Keys in a priority queue can be arbitrary objects on which an order is defined Two distinct items in a priority queue can have the same key Mathematical concept of total order relation
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

PriorityQueues - Priority Queues 2:03 AM Priority Queues...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online