[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

binary search tree

Posted on 2004-04-17
3
Medium Priority
?
218 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 30

Accepted Solution

by:
GrandSchtroumpf earned 200 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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Suggested Courses

650 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