In the case of a binary search tree, you don't always make the left subtree first. See the wikipedia article on binary search trees for details.
Dave On Jun 3, 1:02 pm, Vinodh <[EMAIL PROTECTED]> wrote: > Wow...Got it. > > My refined understanding, > > 1) An empty tree is haveing zero nodes. Fine. > Case (a) > ====== > I have only 1 node in a binary tree. That means it is a binary tree > with 2 empty subtrees. > > Case (b) > ====== > I have only 2 nodes in a binary tree. > That means it is a binary tree with 1 left subtree and 0 right > subtree. > > Fine. Got a question here. Why one always makes the left node first > and then the right node? > > 2) In literature they talk about Nodes. Nodes can have anything stored > on them. Thanks Dave for explaining with a nice example. > > On Jun 3, 8:58 pm, Dave <[EMAIL PROTECTED]> wrote: > > > > > Does that aspect of his question matter as to whether the tree is a > > binary tree or a general tree? The point is that the node and the > > value associated with the node are entirely different things. > > > For that matter, my uncle's family tree is not a tree at all, since he > > has two paths up the tree to the same ancestor. This happened because > > someone in one subtree of that person married someone in anther > > subtree many generations later. > > > Dave > > > On Jun 3, 10:48 am, "Ajinkya Kale" <[EMAIL PROTECTED]> wrote: > > > > On Tue, Jun 3, 2008 at 1:35 PM, Dave <[EMAIL PROTECTED]> wrote: > > > > > The definition is recursive. The empty binary tree is the base case > > > > for the recursion. If a binary tree couldn't be empty, then all binary > > > > trees would have to be infinite. One way to think of this is that the > > > > left and right subtrees of the leaf nodes of the tree are empty trees. > > > > > Don't confuse the nodes with any values associated with the nodes. The > > > > nodes are divided into three disjoint subsets, but duplicate values do > > > > not have to be divided correspondingly. Think of a tree describing > > > > family relationships. I have a second cousin whose name is the same as > > > > mine. There would be two nodes distinct nodes in the tree with value > > > > "David S Dodson." These nodes would have different parents and > > > > grandparents, but the same great-grandparents. > > > > Nice example. Nevertheless family tree are suitable examples for general > > > trees rather than binary trees , isnt it ? > > > > > Dave > > > > > On Jun 3, 5:55 am, Vinodh <[EMAIL PROTECTED]> wrote: > > > > > 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 binary tree is a finite set of elements that is either empty or is > > > > > partitioned into three disjoint subsets. The first subset contains a > > > > > single element called the 'Root' of the tree. The other two subsets > > > > > are themselves binary trees, called the 'Left' and 'Right' subtrees of > > > > > the original tree." > > > > > > My Questions: > > > > > 1) Why they talk about a binary tree that is totally empty? I mean a > > > > > binary tree with Zero elements? > > > > > > 2) A binary tree is partioned into three disjoint subsets. That means > > > > > all the elements in a binary tree should be unique? Duplicate elements > > > > > are allowed within a subtree? Any significance of this? > > > > > > Thanks, > > > > > Vinodh > > > > -- > > > Ciao, > > > Ajinkya- Hide quoted text - > > > > - Show quoted text -- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---