Solved

binary  tree

Posted on 2012-04-07
5
348 Views
Last Modified: 2012-06-27
if I start with an empty tree, and then insert 1,2,3, what do I get?  

if I start with an empty tree, and then insert 6,5,4, what do I get?
0
Comment
Question by:HLRosenberger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 37819807
You should clarify...what KIND of binary tree?

A "binary tree" is simply one where nodes have no more than two children.

A "binary search tree" (BST) is ORDERED and has rules on how nodes are inserted.

An AVL tree is a self-balancing BST that has additional rules on the difference in depth between two child nodes.

Here's an interactive tree that you can actually see what will happen when those sequences are entered into a standard BST:
http://www.cs.jhu.edu/~goodrich/dsa/trees/btree.html
0
 
LVL 1

Author Comment

by:HLRosenberger
ID: 37819840
I've done this stuff before.  Just has been  while.

A binary search tree.  1, 2, 3 would give:   root is 1, right child of 1 is 2, right child of 2 is 3, correct?

6, 5, 4 would give:   root is 6, left child of 6 is 5, left child of 5 is 4, correct?
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 37819851
That's correct.  Those two sequences are probably for demonstrating that a standard BST is no better than a linked list when the data being inserted is ALREADY SORTED.
0
 
LVL 1

Author Closing Comment

by:HLRosenberger
ID: 37819950
Thanks!!
0

Featured Post

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

636 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