quick C question

AKIRA

Tank
Joined
Feb 6, 2006
Messages
3,000
Reaction score
2
I know I'm supposed to post in the hardware/software section but this gets the most traffic and I sort of need an answer asap.

How would I draw a binary tree if they're inserted in the following order: 42,17,66,3,54,21?

I couldn't find this in my notes, does it have something to do with the actual values of elements?

thanks in advance!
 
20100819230324capture.png





Honestly, I have no idea. I don't even know what a binary tree is, really. Maybe they'll cover it in CS106b which I should be starting soon on that free video lecture thing.
 
Here are the steps this particular example doesn't have any re-balancing of the tree I would suggest doing one if your doing this for university because I can almost guarantee you it'll be on the test :D
Edit: on second thought you might not have to re-balance the tree if your just inserting it depends on the question. Just expect a re-balancing question of some sort.

This applet should help: http://www.cs.umd.edu/~egolub/Java/BinaryTree.html

2quq9.jpg

amwi7t.jpg

2uo1hsz.jpg

20a29dw.jpg

1zl7y51.jpg


Sorry for the awful paint job :D
 
hey akira, you know i posted in length about the structure of a balanced binary tree in the previous thread. It kind of seems like you just skim these for the answer , so its kind of pointless to discuss anything in here. Its like you just want your homework done.
 
Back
Top