PriorityQueues - Priority Queues 1/27/2005 2:03 AM Priority...

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

View Full Document Right Arrow Icon
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)
Background image of page 1

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

View Full DocumentRight Arrow Icon
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
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/02/2012 for the course COMPUTER 101 taught by Professor Dr.kahan during the Spring '11 term at Akademia Ekonomiczna w Krakowie.

Page1 / 5

PriorityQueues - Priority Queues 1/27/2005 2:03 AM Priority...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online