Solved: Help using strings in Binary Tree - Java

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

robobobo

Thread Starter
Joined
Apr 27, 2008
Messages
167
Hey Guys,

What I'm trying to do is construct a binary tree, where each node is a string. I've managed to build a binary tree with ints, but I can't figure out how to build one using strings.

When I was building the binary tree using ints, I constructed it by comparing the values of the ints against the int value of the nodes, but because strings aren't ints, I can't seem to see an easy way to compare them so I can build the tree.

The reason I'm trying to build a binary tree is for a 20Q game.

The program will ask the user a question, then if the user answers yes, the question in the left child node will be printed out, and if the the answer is no, the question in the right child node will be printed out and this process continues down until we arrive at a answer

But as I said, my first problem is constructing a binary tree with strings as the nodes instead of ints. How can I do this?

Your help as ever is much appreciated!
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Members online

Top