Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

How do I alphabetize a single linked list of words in Java?

Avatar of datopdogg7
datopdogg7 asked on
20 Comments1 Solution1564 ViewsLast Modified:
Hi experts,

I have been racking my brain about this all day and can't seem to come up with a good way to implement an algorithm to solve my problem.

I have a single linked list. The list stores the object 'Word' which has some methods and members, namely the word itself.

I want to alphabetize this list. There are two scenarios of when it can be done: I can add all the objects in at once and sort after all objects have been put in, or I can put in one object sort the list and then carry on to the next word.

How would you tackle this problem?

The only solution that I have come up with that is viable and some what fast, is to store the words as an array of objects, sort them, then call upon the single linked list class and add them sequentially.

Any help on an algorithm would be appreciated, full points will be awarded for some code in the solution,


Avatar of Mick Barry
Mick BarryFlag of Australia imageJava Developer
This problem has been solved!
Unlock 1 Answer and 20 Comments.
See Answers