most effective method?
I am using algorithms and sorting methods. I am stuck on the very last bit of my problem.
I have linked list of strings, in this list some strings may be 'angram'. for each node in my list, they have a field 'sorted word' and field 'unsorted word.' i am trying to group together all the nodes that have same 'sorted word', there may be none, or a few or many. i need the most efficient way to do this.
I have tried using hashmap but finding it much too difficult.
I have decided i want to use mergesort. I have managed to print out a list of all my nodes. it shows the sorted and the unsorted words for each node. so all the words that have 'sorted word' field the same are next to each other. i now need to group them together.
what is the fastest way to do this? the only way i think of currently is to take the first string, compare it with its neighbour, if their fields are the same, etc etc.
any advice i would be relieved i have hit brick wall