{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Priority Queues and Heaps_Part_1

Priority Queues and Heaps_Part_1 - Main methods of the...

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

Last Updated: 06/02/12 8:32 PM CSE 2011 Prof. J. Elder - 1 - Priority Queues & Heaps Chapter 8

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

View Full Document
Last Updated: 06/02/12 8:32 PM CSE 2011 Prof. J. Elder - 2 - Iterable Collection Abstract Collection Queue List Abstract Queue Priority Queue Array List Abstract List Vector Stack Linked List Abstract Sequential List Interface Abstract Class Class The Java Collections Framework (Ordered Data Types)
Last Updated: 06/02/12 8:32 PM CSE 2011 Prof. J. Elder - 3 - The Priority Queue Class Based on priority heap Elements are prioritized based either on natural order a comparator , passed to the constructor. Provides an iterator

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

View Full Document
Last Updated: 06/02/12 8:32 PM CSE 2011 Prof. J. Elder - 4 - Priority Queue ADT A priority queue stores a collection of entries Each entry is a pair (key, value)
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Main methods of the Priority Queue ADT insert (k, x) inserts an entry with key k and value x removeMin () removes and returns the entry with smallest key Additional methods min () returns, but does not remove, an entry with smallest key size (), isEmpty () Applications: Process scheduling Standby flyers Last Updated: 06/02/12 8:32 PM CSE 2011 Prof. J. Elder - 5 - Total Order Relations Keys in a priority queue can be arbitrary objects on which an order is defined Two distinct entries in a priority queue can have the same key Mathematical concept of total order relation ≤ Reflexive property: x ≤ x Antisymmetric property: x ≤ y ˭ y ≤ x x = y Transitive property: x ≤ y ˭ y ≤ z x ≤ z...
View Full Document

{[ snackBarMessage ]}