Whoops, I believe you're right -- I completely overlooked that as well :( On Fri, May 15, 2015 at 12:40 PM, Paul Sandoz <[email protected]> wrote:
> > On May 15, 2015, at 6:15 PM, Louis Wasserman <[email protected]> wrote: > > > http://lcm.csa.iisc.ernet.in/dsa/node139.html suggests an algorithm for > > heapifying an unsorted array in O(n), corroborated elsewhere at > > http://courses.csail.mit.edu/6.006/fall10/handouts/recitation10-8.pdf . > > Any particular reason we can't use that approach? > > > > Thanks. I got things wrong before. I believe the PQ.heapify() does exactly > that: > > private void heapify() { > for (int i = (size >>> 1) - 1; i >= 0; i--) > siftDown(i, (E) queue[i]); > } > > So there is more value in the constructor than i originally thought. > > Paul. >
