Skip to main content Accessibility help
×
Hostname: page-component-848d4c4894-75dct Total loading time: 0 Render date: 2024-05-21T03:01:02.271Z Has data issue: false hasContentIssue false

5 - Heaps

Published online by Cambridge University Press:  25 January 2011

Peter Brass
Affiliation:
City College, City University of New York
Get access

Summary

Heaps are, after the search trees, the second most studied type of data structure. As abstract structure they are also called priority queues, and they keep track of a set of objects, each object having a key value (the priority), and support the operations to insert an object, find the object of minimum key (find min), and delete the object of minimum key (delete min). So unlike the search trees, there are neither arbitrary find operations nor arbitrary delete operations possible. Of course, we can replace everywhere the minimum by maximum; where this distinction is important, one type is called the min-heap and the other the max-heap. If we need both types of operations, the structure is called a double-ended heap, which is a bit more complicated.

The heap structure was originally invented by Williams (1964) for the very special application of sorting, although he did already present it as a separate data structure with possibly further applications. But it was recognized only much later that heaps have many other, and indeed more important, applications. Still, the connection to sorting is important because the lower bound of Ω(n log n) on comparison-based sorting of n objects implies a lower bound on the complexity of the heap operations. We can sort by first inserting all objects in the heap and then performing find min and delete min operations to recover the objects, sorted in increasing order.

Type
Chapter
Information
Publisher: Cambridge University Press
Print publication year: 2008

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

  • Heaps
  • Peter Brass, City College, City University of New York
  • Book: Advanced Data Structures
  • Online publication: 25 January 2011
  • Chapter DOI: https://doi.org/10.1017/CBO9780511800191.006
Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

  • Heaps
  • Peter Brass, City College, City University of New York
  • Book: Advanced Data Structures
  • Online publication: 25 January 2011
  • Chapter DOI: https://doi.org/10.1017/CBO9780511800191.006
Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

  • Heaps
  • Peter Brass, City College, City University of New York
  • Book: Advanced Data Structures
  • Online publication: 25 January 2011
  • Chapter DOI: https://doi.org/10.1017/CBO9780511800191.006
Available formats
×