Consider the following list of numbers. 128, 685, 126, 513, 605, 50, 41 The height of a binary search tree is the maximum number of edges you have to go through to reach the bottom of the tree, starting at the root. What is the height of the tree for the numbers above, in the order given?
so, you are spose to treeup those numbers eh ....
i binary tree is one in which "branches" stem in order, left < root < right; if we go "in the order given" that would start out as 128 126 685
513 is between 126 and 685 605 has to drop down since it cant fit 50 is less then 605 41 is less than 50 128 126 685 513 50 605 41 if i read that correctly
you might have to read thru it and correct me tho
so to answer the question for the height above is that i have to add 128+126+685?
no, the height of the tree is the number of "rows" that are formed
@amistre64 can we arrange in the way, |dw:1367328429903:dw|
128 126 685 50 513 41 605 of course it might go like this
128 < 605 so it would have to go on the right side
thank you.
so 2 rows?
wait, 4 rows?
row1 128 row2 126 685 row3 50 513 row4 41 605
this question is so confusing .. if its above then 2 rows
im still trying to iron out a few "rules" to be sure :)
ok the answer is not 2 or 4! crap
is it not 3? we have 4 rows, so the edge between them is 3, is it not right?
and by definition of "height of tree" it's the number of the edge from top to bottom?
ok that makes sense
yup 3 was it! thanks guys
thanks for your post, too. I studied the stuff this semester and so confused. review here, XD!!!
thnx Hoa :)
you have 99 smartscore , no way to show appreciation!!! so just "Thank you very much, 99 smart guy!!!"
thanks Hoa :)))))
Join our real-time social learning platform and learn together with your friends!