Binary Trees

benderzfloozy

New member
Joined
Apr 17, 2007
Messages
18
Hi.

I'm just looking for a confirmation, to see if I did this problem right. We had to draw a binary tree represented by the left child-right child representation.

Here's the representation:

Left Child Right Child
1 2 0
2 3 4
3 0 0
4 5 6
5 0 0
6 0 0

This is what I came up with:

1

2

3 4

5 6

(The five and six are the children of 4, and 3 and 4 are the children of 2)

I didn't know how to paste the actual picture in! :)

Thanks!
 
Can you please tell us what all that means? I have no idea what it could mean.
Go to the top of this page. There is a pull-down tab labeled “FORUM HELP”. On that tab is a link on inserting images.
 
Sorry about that. Here's the image:


The first image (the chart) is the binary tree represented by a left child-right child representation. I have to draw out the tree. The second image is the tree I came up with.

I am just looking for an outside opinion as to if this was done correctly. Thanks.

[/img]
 
Code:
    1
   /
  2
 / \
3   4
   / \
  5   6

If that is what you meant then yes, it's correct.
 
Top