I know it's probably uncouth to ask for straight up pointers on where I'm screwing up with my homework, but I've spent close to sixteen or eighteen hours on this one assignment and I cannot wrap my brain around where I've gone wrong with implementing a heap-sort. I've looked at examples. I've done trial-and-error. I'm not really even sure how I got one example working, but the code wasn't operating with a user-made object or with insert or delete functions, which is what my professor is looking for.
I need someone to tell me where my code is wrong and broken and why, definitely why. Would anyone be willing to look it over? It's here.
first up, where you have bounds checking in "insert" you should reject a new value if the heap's already full. you're inserting the value, and only then checking if it's full up. Just so new values don't overwrite a full heap. This is a minor thing though and won't affect your program, but might affect your mark if your lecturer sees it as an error. check first, then insert.
your system of determining parent node is wrong. If you fix that you can also set the "if(x>2)" to "if(x>0)" and do away with the entire "else" section of makeheap, it's not needed if you set the parent node correctly.
x/2 only works when "1" is the root node (e.g. for nodes 2 & 3, x/2 = 1). since c++ arrays start at zero you need to compensate by using
floor(x/2)-1 or int(x/2)-1 floor((x-1)/2) or int((x-1)/2). It's good form to explicitly do the conversion to indicate to the code reader and the compiler that the value is being rounded on purpose, not by accident. Look at your commented out heapify example code, node 2, has children of 5 & 6, not 4 & 5, which it would have if parent was int(x/2).
One thing you should use more of is debug statements, i.e. in each "makeheap" operation, you could have print out the value, the position, and the parent node position / value, as well as a "heap so far" full print (include both values and index with that). That would have helped indicate something was wrong with the wiring.