Solved

binary search tree

Posted on 2004-04-17
3
206 Views
Last Modified: 2010-03-31
Hi, I have to implement this:
Say I am given a text,

why am fish, !
why do swim

I am to produce the following output using binary search tree.

am
do
fish
swim
why

Ok. My question. If i were to use the comparable interface, i do not need to use the euler's rule to traverse through the tree to print out the nodes in alphabetical order, right? So, how do i print it out?

0
Comment
Question by:shiehnee
3 Comments
 
LVL 30

Accepted Solution

by:
GrandSchtroumpf earned 50 total points
ID: 10852325
the comparable interface will help to fill your binary tree with the data.
i.e.: you save it to the left if smaller than parent node and to the right otherwise.
you'll fill your tree with all your data, and then you'll need to traverse it (left-to-right) to get your sorted output.  i don't know about the "euler's rule" for binary trees.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
The viewer will learn how to implement Singleton Design Pattern in Java.
This video teaches viewers about errors in exception handling.

749 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