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

This note was uploaded on 02/14/2012 for the course CSE 2011Z taught by Professor Elder during the Fall '11 term at York University.

Page1 / 5

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

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

View Full Document
Ask a homework question - tutors are online