[CSC 204] CSC 204 Program 5

Andrew J. Pounds pounds_aj at mercer.edu
Wed Dec 7 22:13:11 EST 2016



On 12/07/2016 09:47 PM,
> Hey Dr. Pounds,
>
> In order to use the selection sort in our program, do we need to copy 
> the SelectionSorter.java class into our code? I'm confused on how to 
> use selection sort.
>

Let's make this REALLY simple.  Since you already wrote a method in 
program four which essentially did the bubble sort -- which we said in 
class today should run at roughly the same order as the Selection sort 
-- then you can just use the same sorting method you used in program 
four.  You will have to modify it to work with ArrayLists, but that 
should not be terribly difficult (although it will require some thinking 
about how ArrayLists operate).

> Also are we supposed to be sorting based on the 25 hottest and coldest 
> average temperatures or the hottest and coldest recorded daily 
> temperatures every recorded?
>

You are sorting the ArrayList based on the hottest and coldest daily 
temperatures.   Remember, each temperature in the daily file is the 
average temperature for that particular station on that particular 
day.   Sorting an array of objects this big with either the selection 
sort of the bubble sort will take some time.



-- 
Andrew J. Pounds, Ph.D.  (pounds_aj at mercer.edu)
Professor of Chemistry and Computer Science
Mercer University,  Macon, GA 31207   (478) 301-5627
http://faculty.mercer.edu/pounds_aj

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://theochem.mercer.edu/pipermail/csc204/attachments/20161207/e1121647/attachment.html>


More information about the csc204 mailing list