PDA

View Full Version : Need help for writing a program that does heap sort


kael
05-12-2004, 07:40 PM
I am trying to write a program that does heap sort, and I have to come up with an algorithm and such. I wanted to implement it by first inserting the items into a two dimensional array, with each row acting as a row of the heap. If you know what a heap is then you know it represents a tree and I am trying to figure out when to tell the program when to move to the next row. I think I figured it out by saying take the log base2 and checking that of each row. Thanks!

ds91
05-12-2004, 07:59 PM
haha. you already got an answer. :arrow: :arrow: :arrow: :arrow: :arrow: :arrow: :oops:

squeak
05-12-2004, 10:24 PM
Why not just create a heap class with pointers to other objects. Unless that is the next project (I was allways taught using simple arrays first and the creating class objects instead). BTW, goodluck on your tree, those are a bix.