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

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

1 Data Structures and Algorithms Abstract Data Types IV: Heaps and Priority Queues Gal A. Kaminka Computer Science Department

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

View Full Document
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()
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

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

View Full Document
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
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

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

View Full Document
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)
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)

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

View Full Document
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
Ask a homework question - tutors are online