{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

Info icon This 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
Image of page 1

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

View Full Document Right 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()
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
Image of page 3

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

View Full Document Right 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
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
Image of page 5

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

View Full Document Right 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)
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)
Image of page 7

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern