title: What is the use of the Heap data structure?
body: <p>I'm working on some homework involving Heaps, and I understand how they are structured. A heap must have each node satisfying the heap property,</p>
  
  <blockquote>
    <p>the max-heap property is that for
    every node i other then the root,
    Heap[Parent(i)] >= Heap[i]</p>
  </blockquote>
  
  <p>So at each node, the higher nodes have higher numbers, lower nodes have lower numbers. I understand this. But I can't see a use of a Heap other then to simply get the highest n numbers in a list. I don't see an easy way to search for a particular value and return the node, or to search for the n lowest number (in a max-heap). Both are relatively easy in a binary search tree.</p>
  
  <p>Why wouldn't you just use a simple binary search tree? Or better yet, a balanced binary search tree?</p>
  
  <p>EDIT:
  I should note, that this is not looking for an answer to a homework problem. The actual homework problem was writing pseudocode for parallel-p-heap for the insert() and extractMax() functions. And I already answered them. They just made me realize that I don't really understand Heaps.</p>