473,416 Members | 1,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Binary Trees

Is there a difference between a Binary Tree and a Binary Search Tree? If so
can someone please explain.

Thank You.
Jul 22 '05 #1
11 2499
"jova" <Em***@nospam.net> wrote in message
news:jB******************@nwrdny02.gnilink.net...
Is there a difference between a Binary Tree and a Binary Search Tree? If so can someone please explain.

Thank You.


A binary tree is a tree in which each node has at most 2 children (hence the
term binary), usually denoted the left child and the right child, but there
is no restrictions as to what each node contains relative to other nodes.

A binary search tree is a binary tree that has the additional property that
all children to the left of a parent node contain values that are less than
the parent node, and all children to the right are greater than (where the
equal to nodes go can very from implementation to implementation).

So for example:
8
/ \
6 12
/ \ \
3 7 15

would be a binary search tree, as 3 is less than 6 (and thus to the left), 7
is greater than 6 (and thus to the right), 6 is less than 8 (and thus to 8's
left). Also note that there is nothing less than 12, but greater than 8, so
12 has no left child.

Hope this helps.

Adam
Jul 22 '05 #2
On Sun, 25 Apr 2004 17:30:55 GMT, jova wrote:
Is there a difference between a Binary Tree and a Binary Search Tree? If so
can someone please explain.


Several someones..
<http://google.com/search?q="Binary+Tree"+"Binary+Search+Tree"+differ ence>

And BTW, if you think you are so
important as to justify cross-posting
to four groups, (alt.comp.lang.learn.c-c++,
comp.lang.c++, comp.lang.java,
comp.lang.java.programmer),
please think again.
<http://www.physci.org/codes/javafaq.jsp#xpost>

Invalid group comp.lang.java dropped
F'Ups set to c.l.j.programmer

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 22 '05 #3
Thanks Adam that helps a lot.

Andrew I don't think I'm important I just wanted to someone to explain it to
me in a manner I can understand. I seen someone get flame for not telling
people they crosspost (SO I FIGURED I WAS DOING THE RIGHT THING BY LETTING
EVERYONE KNOW. SO WHEN PEOPLE GO TO OTHER GROUPS THEY WON"T ANSWER THE SAME
QUESTION. YOU CAN'T WIN WITH THIS GROUP) I did a google search I see
diagrams and didn't understand the concept. By actually speaking to someone
semi-live I can get a better understanding of it. I can't ask google a
specific question and get an answer. Google gives only what people put out
there and sometimes I can't understand that. So, I figure I come to the
newsgroup and ask the question. Isn't that's why this is here.

Why is that the C++ newsgroups have a bunch of people ready to attack than
help??? Andrew why don't you GOOGLE SEARCH THAT!!!!

Once again Thanks Adam I do understand it now.

"Andrew Thompson" <Se********@www.invalid> wrote in message
news:cy***************************@40tude.net...
On Sun, 25 Apr 2004 17:30:55 GMT, jova wrote:
Is there a difference between a Binary Tree and a Binary Search Tree? If so can someone please explain.


Several someones..
<http://google.com/search?q="Binary+Tree"+"Binary+Search+Tree"+differ ence>

And BTW, if you think you are so
important as to justify cross-posting
to four groups, (alt.comp.lang.learn.c-c++,
comp.lang.c++, comp.lang.java,
comp.lang.java.programmer),
please think again.
<http://www.physci.org/codes/javafaq.jsp#xpost>

Invalid group comp.lang.java dropped
F'Ups set to c.l.j.programmer

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology

Jul 22 '05 #4
On Sun, 25 Apr 2004 17:30:55 GMT, "jova" <Em***@nospam.net> wrote or
quoted :
Is there a difference between a Binary Tree and a Binary Search Tree? If so
can someone please explain.


no, but there are many flavours of tree structured search indexes.

Some of the more famous B-tree, B+tree, Red-Black tree (used in Java
Collections), binary tree, ISAM. Might check out Knuth for the
bestiary.

See http://mindprod.com/jgloss/knuth.html

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Jul 22 '05 #5
On Sun, 25 Apr 2004 17:55:33 GMT, "jova" <Em***@nospam.net> wrote or
quoted :
I seen someone get flame for not telling
people they crosspost (SO I FIGURED I WAS DOING THE RIGHT THING BY LETTING
EVERYONE KNOW. SO WHEN PEOPLE GO TO OTHER GROUPS THEY WON"T ANSWER THE SAME
QUESTION. YOU CAN'T WIN WITH THIS GROUP)


see http://mindprod.com/jgloss/newsgroups.html for hints on
crossposting.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Jul 22 '05 #6
On Sun, 25 Apr 2004 21:25:56 GMT, Roedy Green
<se*@mindprod.com.invalid> wrote or quoted :
Is there a difference between a Binary Tree and a Binary Search Tree? If so
can someone please explain.


no, but there are many flavours of tree structured search indexes.


I should be more careful. It depends on who is using the term. Most
people throw that term around very loosely to describe any sort of
tree structure even when it is not binary!! e.g. an n-nary tree.

If your CS prof used the terms, he is making the distiction Andrew
mentioned.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Jul 22 '05 #7
"jova" <Em***@nospam.net> wrote in message news:<pY*****************@nwrdny02.gnilink.net>...
Thanks Adam that helps a lot.

Andrew I don't think I'm important I just wanted to someone to explain it to
me in a manner I can understand. I seen someone get flame for not telling
people they crosspost (SO I FIGURED I WAS DOING THE RIGHT THING BY LETTING
EVERYONE KNOW. SO WHEN PEOPLE GO TO OTHER GROUPS THEY WON"T ANSWER THE SAME
QUESTION. YOU CAN'T WIN WITH THIS GROUP) I did a google search I see
diagrams and didn't understand the concept. By actually speaking to someone
semi-live I can get a better understanding of it. I can't ask google a
specific question and get an answer. Google gives only what people put out
there and sometimes I can't understand that. So, I figure I come to the
newsgroup and ask the question. Isn't that's why this is here.

Why is that the C++ newsgroups have a bunch of people ready to attack than
help??? Andrew why don't you GOOGLE SEARCH THAT!!!!

Once again Thanks Adam I do understand it now.

"Andrew Thompson" <Se********@www.invalid> wrote in message
news:cy***************************@40tude.net...
On Sun, 25 Apr 2004 17:30:55 GMT, jova wrote:
Is there a difference between a Binary Tree and a Binary Search Tree? If so can someone please explain.


Several someones..
<http://google.com/search?q="Binary+Tree"+"Binary+Search+Tree"+differ ence>

And BTW, if you think you are so
important as to justify cross-posting
to four groups, (alt.comp.lang.learn.c-c++,
comp.lang.c++, comp.lang.java,
comp.lang.java.programmer),
please think again.
<http://www.physci.org/codes/javafaq.jsp#xpost>

Invalid group comp.lang.java dropped
F'Ups set to c.l.j.programmer

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology

m m
Jul 22 '05 #8
jova wrote:
Is there a difference between a Binary Tree and a Binary Search Tree? If so
can someone please explain.


First off, your question is off-topic in all of the newsgroups you
posted to (and comp.lang.java is not a valid newsgroup.) Your question
belongs in comp.programming (follow-ups set).

Normally, they are interchangeable terms, but if you want to be
pedantic, a binary search tree imposes a certain order on the nodes of
the tree while a normal binary tree just means that each node has no
more than two leaves.
--
Daniel Sjöblom
Remove _NOSPAM to reply by mail
Jul 22 '05 #9
On Sun, 25 Apr 2004 17:55:33 GMT, jova wrote:
Andrew I don't think I'm important I just wanted to someone to explain it to
me in a manner I can understand.
You could have expressed that in your question.
<http://www.physci.org/codes/javafaq.jsp#specific>
..I seen someone get flame for not telling
people they crosspost (SO I FIGURED I WAS DOING THE RIGHT THING BY LETTING
EVERYONE KNOW.
Try basing your actions on actual information
in future. You do not seem terribly good at
this 'figuring'..

And please do not yell. I am not deaf.
..SO WHEN PEOPLE GO TO OTHER GROUPS THEY WON"T ANSWER THE SAME
QUESTION. YOU CAN'T WIN WITH THIS GROUP)
If they had any sense they would do the
same Google search I specified for you.

They would probably not be chasing up lazy
2 line questions that were cross-posted to
four groups.
..I did a google search I see
diagrams and didn't understand the concept.
Where did you express that in your smart question.?
<http://www.catb.org/~esr/faqs/smart-questions.html#before>

You _now_ claim to have done those things
(though not very convincingly), so let's
add a seventh..
7. Do not presume the audience is psychic
...By actually speaking to someone
semi-live I can get a better understanding of it. I can't ask google a
specific question and get an answer. Google gives only what people put out
there and sometimes I can't understand that. So, I figure I come to the
newsgroup and ask the question. Isn't that's why this is here.
To 'Ask a specific question and
get a (specific) answer'?

No. You are thinking of an _HelpLine_.
You pay for those, it's a service.

Newsgroups are communities of people who wish
to discuss subjects of common interest.
Why is that the C++ newsgroups have a bunch of people ready to attack than
help??? Andrew why don't you GOOGLE SEARCH THAT!!!!


(chuckles) I am glad you blamed the C++
folks. 'We' are horrible, no? ;-)

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 22 '05 #10
> >...By actually speaking to someone
semi-live I can get a better understanding of it. I can't ask google a
specific question and get an answer. Google gives only what people put out there and sometimes I can't understand that. So, I figure I come to the
newsgroup and ask the question. Isn't that's why this is here.


To 'Ask a specific question and
get a (specific) answer'?

No. You are thinking of an _HelpLine_.
You pay for those, it's a service.

Newsgroups are communities of people who wish
to discuss subjects of common interest.


according to http://mindprod.com/jgloss/newsgroups.html (which was posted
by Roedy Green) a newsgroup is
newsgroups
Newsgroups are Internet forums, sort of like electronic bulletin boards,
where you can post questions.


Jul 22 '05 #11
On Mon, 26 Apr 2004 05:35:33 GMT, "jova" <Em***@nospam.net> wrote or
quoted :
Newsgroups are Internet forums, sort of like electronic bulletin boards,
where you can post questions.


Some people are frustrated because they imagine they are obligated to
read and answer nearly every post. It becomes infuriating when you
can't make any sense of the question.

You feel a sick feeling in your stomach, knowing this person is going
to be ignored, and he may never know why.

So you simultaneously feel pity and anger at having to deal with the
situation.

Sometimes the questioner is playing dumb blonde, and saying in effect,
poor widdle me. I am so stupid. Will you do my homework for me. The
only effort I am prepared to go to is to post the assignment. I have
no intention of even trying to understand the answer.

These people are infuriating. This a place to LEARN Java. If you
don't want to do that, GO AWAY. You are despised as a species of con
man. Their are so many more deserving people trying their best.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Jul 22 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: abhrajit | last post by:
I'm looking for a C/C++/Java library to create a balanced binary tree data structure given a set of leaf nodes as input. A leaf node should never become an interior node. So if I wish to create...
4
by: Rasmus | last post by:
Hi. As partly novice in python I would like a piece of advise of how to implement (binary) trees the best way? Thanks in advance, Rasmus PS: Due to heavy spam reception (20.000+/week), I...
6
by: JC | last post by:
Hi, I'm looking for some help on Binary trees, in particular levels, heights etc. I need to find the levels of a tree, I also need to determine the minimum, maximum and average leaf levels. ...
1
by: Jerry Khoo | last post by:
hello, everybody, i am kinda new here, nice to meet u all. Now, i am > cs students and are now facing difficult problems in understanding > what a binary tree is, how it works, and the algorithm...
15
by: Foodbank | last post by:
Hi all, I'm trying to do a binary search and collect some stats from a text file in order to compare the processing times of this program (binary searching) versus an old program using linked...
3
by: ptrSriram | last post by:
Can someone help me with an algorithm to merge two binary search trees. One method I thought of was to flatten both the trees into sorted lists(inorder traversal),merge those two sorted lists,...
8
by: sudharsan | last post by:
please gimme the logic to merge two binary search trees?I mean which node has to be the root node of the new binary tree?? Thanks in advance
10
by: free2cric | last post by:
Hi, I have a single link list which is sorted. structure of which is like typedef struct mylist { int num; struct mylist *next;
2
by: pyguy | last post by:
Hi all, I am running into a conceptual glitch in implementing a simple binary tree class. My insertion and printing (sorting) seems to be ok, but when I search the tree, my find method isn't doing...
7
by: Vinodh | last post by:
Started reading about Binary Trees and got the following questions in mind. Please help. Definition of a Binary Tree from "Data Structures using C and C++ by Tanenbaum" goes like this, "A...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.