beachbumm
asked on
binary search tree
70
\
\
80
/ \
/ \
85 100
/ \ / \
/ \ / \
65 88 90 110
my question is this a binary search tree?? i say no, am i right?
given the level of every node, what is the height of the tree?
\
\
80
/ \
/ \
85 100
/ \ / \
/ \ / \
65 88 90 110
my question is this a binary search tree?? i say no, am i right?
given the level of every node, what is the height of the tree?
ASKER
i agree with you that this is not a binary search tree but when i state the level of every node and height is this 1,2,3,3,4,4,4,4; 4 or is it 0,1,2,2,3,3,3,3; 4?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
looks like homework questions to me...
all your questions are so simple and academic in nature: you should read your C++ and Data structures books more carefully. all those answers can be found in any beginners' books about these subjects...
all your questions are so simple and academic in nature: you should read your C++ and Data structures books more carefully. all those answers can be found in any beginners' books about these subjects...
ASKER
comment about these being homework questions...i am 30 and by far not in school, but do take that as a compliment! im self teaching myself the C language as to one day be able to write programs for the business i own. these questions are exercises out of a book and sometimes i need assistance in how the answer is achieved for my own knowledge.
This tree fails that criterion in that 65 is to the right of 70, as is 80. One is less, the other is more, so the tree is not in order.
If it is in order, then when you are searching for a particular node, you can easily determine which node to inspect next, depending on whether the node you want is greater or lesser than the one you are currently considering.
The height would appear to be 4.