Solved

binary search tree

Posted on 2004-04-17
3
183 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
basic hardware to learn oop advanced design patterns 3 88
JAVA part two 5 56
Non-recursive backtracking, using a stack 1 96
arguments to jar 5 7
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

932 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now