Fast merge function in heap pqueue -> pointer?
<p>I'm trying to do a fast merge function in a heap implementation of priority queue. I'm doubling heappqueue one's "heap" array (of strings), to start. Am I right in thinking that "string first = one->heap[count]" would give me a string called "first" that is the string at int count in the array "heap" (private member array in the heappqueue class)? I'm getting some weird results...</p>

<pre><code>HeapPQueue *HeapPQueue::merge(HeapPQueue *one, HeapPQueue *two) {
    one-&gt;expandCapacity();// Double heappqueue one's heap capacity
    int size2 = two-&gt;logSize;
    int count = 1;
        for (int i = size2 + 1; i &lt;= size2 * 2; i++) {// concatinate heaps by copying heappqueue one's heap again
            string first = two-&gt;heap[count];
            one-&gt;heap[i] = first;
            count++;
            one-&gt;logSize++;// increase heapqueue one's logSize as it copies
    }
    int index = one-&gt;logSize;
    one-&gt;reverseHeapify(index);// call to private member function on heappqueue one

    return one;
}

void HeapPQueue::reverseHeapify(int index) {
    if (index == 1) return; // base case
    string this1 = heap[index];
    string node1 = heap[index / 2];
    if (node1 &gt; this1) {
        heap[index / 2] = this1;
        heap[index] = node1;
    }

    reverseHeapify(index - 1);

}
</code></pre>
