1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Help using strings in Binary Tree - Java

Discussion in 'Software Development' started by robobobo, Nov 28, 2011.

Thread Status:
Not open for further replies.
  1. robobobo

    robobobo Thread Starter

    Apr 27, 2008
    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!
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 733,556 other people just like you!

Similar Threads - Solved Help using
  1. charlzguitarz
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1028839

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice