This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Is there any other way to do the selection sort? I am trying to use selection sort on a linklist to sort Double numbers. I wrote a method to find the smallest number as follows:
Then I used the thePosition which is a LinkList to swap the first value with the smallest. For that I wrote another method as follows:
I thought since in for loop it says p = p.itsNext, it will find the smallest value in the emaining list afte it swapped the smallest value with the 1st value in the list. Somehow its is not sorting properly. What am i doing wrong? Or is there any other way to do the selection sort? Removing the largest number & putting it, doesn't work as it inserts the number after the 1st value - a friend has already tried that. Please help!!! (edited by Cindy to format code) [This message has been edited by Cindy Glass (edited May 14, 2001).]