Chan wrote:
You mean a 'String'? Remember Java is case-sensitive.
Yes, I mean 'String'. I understand that Java is case-sensitive. The sentence I wrote was not in code, so I sometime fall back to my default English language which is also case-sensitive.
Chan wrote:
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.
No. I guess I wasn't clear enough when I said "The integer would strictly be used to record the number of times the string appears." If a duplicate String appears, instead of inserting the String that already exists, the count integer would advance one. So, the first time the word "programming" appears, it is inserted into the tree along with an integer which would hold the starting value of 1. The next time the word "programming" appears, when the search algorithm finds the duplication, it would trigger the count integer to advance to 2 and would not insert the duplicate into the tree. The compared Strings would be setup to not be case-sensitive.
Chan wrote:
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?
Let's go with if greater than, go right. If lesser than, go left.
How does a delete operation correct the count value in the affected nodes ( i.e for cases when you have count > 1 ).
Fair enough. In this project, it will be insert only. This is strictly to keep track of the number of times a String appears in a text file that will be read by the program. No deletions will occur. However, I think a re-balancing of the tree should occur after a couple of insertions.
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?
Thanks
Chan wrote:
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.
Chan
.
I haven't coded anything yet. I am trying to figure out how to make this work and looking for a starting point. I know how I'd like it to work, but can not quite figure out how to begin. As such, I decided to request help from people more knowledgeable then myself on the subject. I thought someone could point me towards my goal, or perhaps knew of existing code that I could use as a starting point, but would require reworking it to make it fit.