944,153 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 927
  • Java RSS
Nov 2nd, 2009
0

How to use Binary Search Tree with String? Is there any ready code?

Expand Post »
Hi..

Is there any ready-made code for "Binary Search Tree" for Strings?

if not, how to use Binary Search Tree with Strings?

Thanks.
Similar Threads
Reputation Points: 10
Solved Threads: 2
Junior Poster
Q8iEnG is offline Offline
164 posts
since Jun 2008
Nov 3rd, 2009
0
Re: How to use Binary Search Tree with String? Is there any ready code?
Any idea?
Reputation Points: 10
Solved Threads: 2
Junior Poster
Q8iEnG is offline Offline
164 posts
since Jun 2008
Nov 3rd, 2009
-7
Re: How to use Binary Search Tree with String? Is there any ready code?
Yes. Use e.g

Java Syntax (Toggle Plain Text)
  1. if (stringname.compareTo(otherstringname) < 0)
  2. {
  3. // the word is "greater" than the other one, so e.g add it to its "right"
  4. }

I used a BST like this as part of an english-to-french translator.
Moderator
Featured Poster
Reputation Points: 1800
Solved Threads: 575
Moderator
jbennet is offline Offline
16,534 posts
since Apr 2005
Nov 3rd, 2009
0
Re: How to use Binary Search Tree with String? Is there any ready code?
Click to Expand / Collapse  Quote originally posted by jbennet ...
Yes. Use e.g

Java Syntax (Toggle Plain Text)
  1. if (stringname.compareTo(otherstringname) < 0)
  2. {
  3. // the word is "greater" than the other one, so e.g add it to its "right"
  4. }

I used a BST like this as part of an english-to-french translator.
Umm, thanks for the code and reply mate.

But, I really didn't got it! and Will this will work with array of strings?

For example if I have an array of strings, will this method sort the array to a BST?
Reputation Points: 10
Solved Threads: 2
Junior Poster
Q8iEnG is offline Offline
164 posts
since Jun 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Casting of int[] to Object[]
Next Thread in Java Forum Timeline: Error [for the type QPlainTextEdit]





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC