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

Reply

Join Date: Jun 2008
Posts: 130
Reputation: Q8iEnG is an unknown quantity at this point 
Solved Threads: 2
Q8iEnG Q8iEnG is offline Offline
Junior Poster

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

 
0
  #1
25 Days Ago
Hi..

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

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

Thanks.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 130
Reputation: Q8iEnG is an unknown quantity at this point 
Solved Threads: 2
Q8iEnG Q8iEnG is offline Offline
Junior Poster
 
0
  #2
24 Days Ago
Any idea?
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 16,147
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 530
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Moderator
 
-7
  #3
24 Days Ago
Yes. Use e.g

  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.
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 130
Reputation: Q8iEnG is an unknown quantity at this point 
Solved Threads: 2
Q8iEnG Q8iEnG is offline Offline
Junior Poster
 
0
  #4
24 Days Ago
Originally Posted by jbennet View Post
Yes. Use e.g

  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?
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC