PQ - CSE 4101/5101 Priority Queues Prof. Andy Mirzaian...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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 19-2 (pp:527-529) 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 min-PQ: the lower the key the higher the priority. 3. DeleteMax for max-PQ: 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-) heap-ordered iff nodes x root(T): key[x] key[parent(x)]. 10 40 14 28 18 36- super-root [ Note: Any subtree of a heap-ordered tree is heap-ordered.] Heap: a forest of one or more node-disjoint heap-ordered 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, Min-Cost 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

Page1 / 85

PQ - CSE 4101/5101 Priority Queues Prof. Andy Mirzaian...

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

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