Skip to main content Accessibility help
Internet Explorer 11 is being discontinued by Microsoft in August 2021. If you have difficulties viewing the site on Internet Explorer 11 we recommend using a different browser such as Microsoft Edge, Google Chrome, Apple Safari or Mozilla Firefox.

Chapter 19: Heaps and Priority Queues

Chapter 19: Heaps and Priority Queues

pp. 517-537

Authors

, Rollins College, Florida
Resources available Unlock the full potential of this textbook with additional resources. There are free resources and Instructor restricted resources available for this textbook. Explore resources
  • Add bookmark
  • Cite
  • Share

Summary

A heap is a tree-based data structure that’s designed to quickly return the maximum or minimum of its items. Like a search tree, it maintains a special ordering among its nodes, and takes advantage of the hierarchical nature of binary trees to perform its operations in O(log n) time. Heaps are the primary implementation of the priority queue abstract data type. Like the first-in-first-out queues we studied in Chapter 13, a priority queue supports operations to insert and remove elements, but also maintains an ordering among its items. Polling the queue returns the next item according to the underlying ordering, rather than strictly returning items in FIFO order. Priority queues are used in applications that need to continually fetch the “next” item of a dynamic set that may change over time. A common application is ordering events by time in a simulation program.

About the book

Access options

Review the options below to login to check your access.

Purchase options

eTextbook
US$69.99
Hardback
US$69.99

Have an access code?

To redeem an access code, please log in with your personal login.

If you believe you should have access to this content, please contact your institutional librarian or consult our FAQ page for further information about accessing our content.

Also available to purchase from these educational ebook suppliers