Priority Queues and Heaps_Part_1

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

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

View Full Document Right Arrow Icon
Last Updated: 06/02/12 8:32 PM CSE 2011 Prof. J. Elder - 1 - Priority Queues & Heaps Chapter 8
Background image of page 1

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

View Full DocumentRight Arrow Icon
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)
Background image of page 2
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
Background image of page 3

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

View Full DocumentRight Arrow Icon
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)
Background image of page 4
Background image of page 5
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 Right Arrow Icon
Ask a homework question - tutors are online