6-heaps - Data Structures and Algorithms Abstract Data...

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

View Full Document Right Arrow Icon
1 Data Structures and Algorithms Abstract Data Types IV: Heaps and Priority Queues Gal A. Kaminka Computer Science Department
Background image of page 1

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

View Full DocumentRight Arrow Icon
1 Priority Queues Queue: First in, first out First to be removed: First to enter Priority queue: First in, Largest out First to be removed: Highest priority Operations: Insert(), Remove-top()
Background image of page 2
1 Applications Process scheduling Give CPU resources to most urgent task Communications Send most urgent message first Event-driven simulation Pick next event (by time) to be simulated
Background image of page 3

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

View Full DocumentRight Arrow Icon
1 Types of priority queues Ascending priority queue Removal of minimum-priority element Remove-top(): Removes element with min priority Descending priority queue Removal of maximum-priority element Remove-top(): Removes element with max priority
Background image of page 4
1 Generalizing queues and stacks Priority queues generalize normal queues and stacks Priority set by time of insertion Stack: Descending priority queue Queue (normal): Ascending priority queue
Background image of page 5

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

View Full DocumentRight Arrow Icon
1 Representing a priority queue (I) Sorted linked-list, with head pointer Insert() Search for appropriate place to insert O(n) Remove() Remove first in list O(1)
Background image of page 6
1 Representing a priority queue (II) Unsorted linked-list, with head pointer Insert() Search for appropriate place to insert O(1) Remove() Remove first in list O(n)
Background image of page 7

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

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/31/2010 for the course COMPUTER S 700 taught by Professor Joewhite during the Spring '10 term at Universidad San Martín de Porres.

Page1 / 32

6-heaps - Data Structures and Algorithms Abstract Data...

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

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