+ 1
CALLING ALL C MASTERS!!!
Hey there guys! Im having some trouble with this C code im writing. I was trying to implement my favorite sorting algorithm. So I have fiddled with it for a while and it looks like the HeapSort function is never getting hit. It makes me think im somehow the recursion in the maxHeapify function is broken. Im not sure if this is an issue with the logic or some technique to recursion in c. https://code.sololearn.com/c1FtKAJ07Y8T
5 Respuestas
+ 1
hey, your code seems to be unnecessarily complicated, here's a simpler way to do it:
https://code.sololearn.com/crNANNRDaKAF/?ref=app
+ 1
@hinanawi yaaaa I just wanted to get experience taking user input and messing around with pointers. It turns out one of the problems I was having was because the logic for my Left and Right function was messed up. I made some changes and now it looks like I am reading the data in wrong somehow because some of the indexes of the array appear to contain garbage. Could you check it out one more time?
https://code.sololearn.com/c1FtKAJ07Y8T
+ 1
@hinanawi sorry about that! ill clean uo the output real quick to better illestrate what is going on
+ 1
i finally got it!!! https://code.sololearn.com/c1FtKAJ07Y8T/?ref=app
0
Haon1919 your code output is not the most readable, can't quite tell what's going on