• Wincent
    Open
  • Blog
  • Wiki
  • Snippets
  • Tags
  • Search

HeapEdit

Created 4/9/2013, updated 5/18/2017

Operations

Core operations

  • insert O(log n)
  • extract O(log n)
    • extract min (for a min heap)
    • extract max (for a max heap)

Other operations

  • heapify (ie. batch insert) O(n)
  • delete O(log n)

Example applications

  • Dijkstra’s shortest path algorithm: O(m log n)
  • Heapsort: O(n log n)

In general, any algorithm that requires a priority queue.

See also

  • Wikipedia article on heaps: http://en.wikipedia.org/wiki/Heap_(data_structure)
  • data.structures
  • wiki
Site
  • About
  • Blog
  • Wiki
  • Snippets
  • Tags
  • Search
External
  • GitHub
  • Twitter
  • YouTube
  • Facebook
  • LinkedIn
Colophon

Made by Greg Hurrell using React, Relay and GraphQL (with help from Git, Redis and Neovim).