Solved

binary search tree

Posted on 2000-04-26
5
297 Views
Last Modified: 2013-11-15
                                         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?
0
Comment
Question by:beachbumm
5 Comments
 
LVL 16

Expert Comment

by:imladris
Comment Utility
It's a binary tree. I would be inclined to indicate whether the tree can be USED for searching or not. To use a tree for searching (efficiently) the tree must be ordered. That requires that all nodes to the right of any particular node be "greater" and all nodes to the left be "lesser" than the that node (where greater and lesser could be defined in various ways, in the general case, depending on the data that is being used).
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.
0
 

Author Comment

by:beachbumm
Comment Utility
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?
0
 
LVL 5

Accepted Solution

by:
Jan Louwerens earned 10 total points
Comment Utility
the height of the tree is 4.
the levels of each node are (top down, left to right) 1,2,3,3,4,4,4,4
0
 
LVL 1

Expert Comment

by:mournblade
Comment Utility
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...
0
 

Author Comment

by:beachbumm
Comment Utility
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.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
Workplace bullying has increased with the use of email and social media. Retain evidence of this with email archiving to protect your employees.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.
An overview on how to enroll an hourly employee into the employee database and how to give them access into the clock in terminal.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now