No. no, no, don't look there, because I happen to know one page in that link has a little application which counts words in text. It is really long and complicated: about ten lines.
Earlier, I wrote:
. . . about ten lines.
No, I was mistaken. even if you miss out comments and blank lines, it comes to twelve lines.
Now I know what the application is for, I would suggest you do the counting first and the sorting afterwards.
There are algorithms which people use to try and identify authors' styles.
Campbell Ritchie wrote:
But: Why are the methods private and static? If they are private, they are only accessible inside your class. If they are inside the class only, the tree must be a member of that class, and ought to be an instance field. So why have you made those methods static?
You mean a 'String'? Remember Java is case-sensitive.
So that means the String's' can repeat and the tree can hold duplicates. You have not specified how you would handle inserts/updates/deletes of duplicate nodes.
Does an equal node traverse the right subtree or does it traverse the left subtree of this node? What is your algorithm ( let us know in plain text ) going to be?
How does a delete operation correct the count value in the affected nodes ( i.e for cases when you have count > 1 ).
Scotty Steven wrote:
Any suggestions on how to do this, or do you know of code that already exist similar to what I'm looking to do that cam be studied?
What have you tried? Plus I think we require more details about your problem statement and we need to know your algorithm. Implementation comes much later.