this function wouldnt work for all cases think about this case. 5 items all in increasing order , and the 2nd to last item has a left child. your code will check the first item which is the root (starting point) and see that its left child is NULL, then it returns the NULL value, which will seg fault
I feel like I actually learned more here than in my DS class in college, no all heroes wear capes
excellent!!! Can you also create an AVL tree project? How to insert, remove, and rotate while keeping the tree balanced?
You can improve the code by eliminating the "else" clauses that follow if's with function return
what do you replace them with?
yet another great video.cheers man!
this function wouldnt work for all cases
think about this case.
5 items all in increasing order , and the 2nd to last item has a left child.
your code will check the first item which is the root (starting point)
and see that its left child is NULL, then it returns the NULL value, which will seg fault
What are you talking about? The example you mention would return the root key
+David Huynh (Magic Man) never mind, my original post is actually wrong, so just ignore what I said, thanks