Hello I am currently working on this code and the code can be runned well from 100-10,000 random elements after that the heap sort says stack over flow, im thinking the recursive calls are the cause of this, so please healp public static void MAX_HEAPIFY(int [] A, int i, int n) { int l = i + 1;//sets the left tree root int r = i + 2;//sets the right tree root int largest = 0; if(l <= n && A[l] > A[i]) { largest = l; } else { largest = i; } if(r <= n && A[r] > …

Member Avatar
Member Avatar
+0 forum 3

Hello, This isn't the typical "I wrote a heap sort that doesn't work, help me please" thread, instead, I'm one step before that. I'd really like to [B]understand[/B] the innards of a heap sort before I attempt to write one. I'd like to give it a go from scratch, or from some basic pseudo code before resorting to dissecting an already written heap sort algorithm. Any information you could give to gently clear up the mystery here would be greatly appreciated. Regards, WigglesMcMuffin

Member Avatar
Member Avatar
+0 forum 1

Hey guys I've been asked to create an array of objects on the heap for my assignment but I cant seem to find any examples that explain it well enough on the web. So what I got is: [CODE]//Heabder File class Wheel{ public: Wheel() : pressure(32) { ptrSize = new int(30); } Wheel(int s, int p) : pressure(p) { ptrSize = new int(s); } ~Wheel() { delete ptrSize; } void pump(int amount) { pressure += amount; } private: int *ptrSize; int pressure; }; [/CODE] Ok so thats the wheel class and I have to coppy the objects into my "RacingCar" …

Member Avatar
Member Avatar
+0 forum 5

The End.