title: How would I change this function to implement a Min Heap instead of max?
body: <p>Does anyone know how I would make a min heap instead of max heap? this function creates a max heap but I have no idea how to make it a min.</p>
  
  <pre><code>void siftUp(int heap[], int n) {
          // Sift the value in heap[n] so that heap[1..n] is a heap
          int siftItem = heap[n];
          int child = n;
          int parent = child / 2;
          while (parent &gt; 0) {
              if (siftItem &gt;= heap[parent]) {
                  break;
              }
              heap[child] = heap[parent];         // Move the parent down
              child = parent;
              parent = child / 2;
          }
          heap[child] = siftItem;
      }
  </code></pre>