# Thread: Binary Search Tree (traversals) Question

1. Senior Member
Join Date
Oct 2011
Posts
115
Rep Power
0

## Binary Search Tree (traversals) Question

Here is the question:

1.)Draw the tree that would be formed by inserting the words in this question into a binary search tree. Use lowercase letters.

Here's what I have:

Binary search tree with 22 words will have only 20 words as the and tree are repeated...I believe this is correct

2.) Show all three traversals of this tree.

Inorder:
a binary by be draw formed in letters lowercase into question search inserting that the this tree use words would
Preorder:
draw be a by binary the that formed inserting in question into lowercase letters search tree this would words use
Postorder:
a binary by be formed in letters lowercase into search question inserting that this use words would tree the draw

or

draw the tree would words use this that formed inserting question search into lowercase letters be by binary a

Does it look like I'm doing this correctly?

2. ## Re: Binary Search Tree (traversals) Question

Originally Posted by kraigballa
Does it look like I'm doing this correctly?
Doing what correctly? That tree looks nice though ...

kind regards,

Jos

3. Senior Member
Join Date
Oct 2011
Posts
115
Rep Power
0

## Re: Binary Search Tree (traversals) Question

Doing the problems...does the tree look correct. And then for part 2, do my traversals of that tree look correct?

4. ## Re: Binary Search Tree (traversals) Question

Originally Posted by kraigballa
Doing the problems...does the tree look correct. And then for part 2, do my traversals of that tree look correct?
The tree looks fine to me but I don't understand your remarks/comment for the three traversals of a binary tree ...

kind regards,

Jos

5. Senior Member
Join Date
Oct 2011
Posts
115
Rep Power
0

## Re: Binary Search Tree (traversals) Question

For part 2 you have to take the words off the tree in a certain order based on what traversal it is. I Google'd each and after readin what they were supposed to do I implemented it on my tree. However, I'm not sure if they are correct.

6. ## Re: Binary Search Tree (traversals) Question

Show us your implementation of the different traversals.

kind regards,

Jos

7. Senior Member
Join Date
Oct 2011
Posts
115
Rep Power
0

## Re: Binary Search Tree (traversals) Question

Originally Posted by kraigballa
Inorder:
a binary by be draw formed in letters lowercase into question search inserting that the this tree use words would
Preorder:
draw be a by binary the that formed inserting in question into lowercase letters search tree this would words use
Postorder:
a binary by be formed in letters lowercase into search question inserting that this use words would tree the draw

or

draw the tree would words use this that formed inserting question search into lowercase letters be by binary a
Preorder traversal
node, left, right
prefix expression

Postorder traversal
left, right, node
postfix expression

Inorder traversal
left, node, right
infix expression

8. ## Re: Binary Search Tree (traversals) Question

Yep, that's the idea.

kind regards,

Jos

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•