This preview shows pages 1–10. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CSE 4101/5101 Priority Queues Prof. Andy Mirzaian TOPICS Priority Queues Leftist Heaps Skew Heaps Binomial Heaps Fibonacci Heaps Recent Developments 2 References: [CLRS 2nd edition] chapters 19, 20 or [CLRS 3rd edition] chapter 19 & Problem 192 (pp:527529) Lecture Notes 4, 5 AAW animations 3 Priority Queues 4 Basic Priority Queues Each item x has an associated priority denoted key[x]. Item priorities are not necessarily distinct and may be time varying. A Priority Queue Q is a set of prioritized data items that supports the following basic priority queue operations: Insert(x,Q): insert (new) item x into Q. (Duplicate priorities allowed.) DeleteMin(Q): remove and return the minimum key item from Q. Notes: 1. Priority Queues do not support the Dictionary Search operation. 2. DeleteMin for minPQ: the lower the key the higher the priority. 3. DeleteMax for maxPQ: the higher the key the higher the priority. 4. More PQ operations shortly. Example: An ordinary queue can be viewed as a priority queue where the priority of an item is its insertion time. 5 HEAP Heap Ordered Tree: Let T be a tree that holds one item per node. T is (min) heapordered iff nodes x root(T): key[x] key[parent(x)]. 10 40 14 28 18 36 superroot [ Note: Any subtree of a heapordered tree is heapordered.] Heap: a forest of one or more nodedisjoint heapordered trees. 20 40 22 60 24 32 56 38 56 76 46 52 6 Some Applications Sorting and Selection. Scheduling processes with priorities. Priority driven discrete event simulation. Many Graph and Network Flow algorithms, e.g., Prims Minimum Spanning Tree algorithm, Dijkstras Shortest Paths algorithm, Max Flow, MinCost Flow, Weighted Matching, Many problems in Computational Geometry, e.g., plane sweep (when not all events are known in advance). 7 More Heap Operations Mergeable Heap Operations: MakeHeap(e): generate and return a heap that contains the single item e with a given key key[e]. Insert(e,H): insert (new) item e, with its key key[e], into heap H. FindMin(H): return the minimum key item from heap H. DeleteMin(H): remove and return the minimum key item from heap H. Union(H1, H2): return the heap that results from replacing heaps H1 and H2 by their disjoint union H1 H2. (This destroys H1 and H2.) DecreaseKey(x,K,H): Given access to node x of heap H with key[x] > K, decrease Key[x] to K and update heap H. Delete(x,H): Given access to node x of heap H, remove the item at node x from Heap H. 8 Beyond Standard Heap Williams[1964]: Array based binary heap (for HeapSort). See [CLRS ch 6]. Time complexities of mergeable heap operations on this structure are: O(1) MakeHeap(e), FindMin(H)....
View Full
Document
 Winter '12
 Mirzaian
 Data Structures

Click to edit the document details