reset password
Author Message
shauncarels
Posts: 1
Posted 20:23 Nov 27, 2012 |

Rewrite SelectionSort.java by finding the smallest number and swapping it with the first number in the array.

Before modification the output is:

 

My list before sort is:

5.0  4.4  1.9  2.9  3.4  3.5

 

My list after sort is:

1.9  2.9  3.4  3.5  4.4  5.0

 

What is the goal of the problem?

I interpreted it several ways which all seem right to me, which is correct?

A)  Simply switch the number resulting in:

 

My list before sort is:

5.0  4.4  1.9  2.9  3.4  3.5

 

My list after sort is:

1.9  4.4  5.0  2.9  3.4  3.5

 

B) Change the method by which the program sorts resulting in:

My list before sort is:

 

5.0  4.4  1.9  2.9  3.4  3.5

 

My list after sort is:

5.0  4.4  3.4  3.5  2.9 1.9

 

C) Or change the method by which it sorts finding the minimum the first time and switching it with the first number and then finding the new minimum each consecutive time switching it to result in:

 

My list before sort is:

5.0  4.4  1.9  2.9  3.4  3.5

 

My list after sort is:

1.9  2.9  3.4  3.5  4.4  5.0

 

(AKA the same output before change, just a different way of doing it)

 

 

Last edited by shauncarels at 20:24 Nov 27, 2012.