0

Hello,

For some work I have to implement the selection sort algorithm on an array list, I dont really know how to do this. I have started off the code but I just need to actually implement the selection sort! This is proving to be the stumbling block.

Here is what I have so far:

```
import java.util.ArrayList;
import java.util.Random;
public class selectionSort
{
public static final int list = 10;
public static void main(String[] args){
ArrayList<Integer> input = new ArrayList<Integer>();
Random r = new Random();
System.out.print("Selection sort-algorithm");
System.out.print("\n\nInput: ");
for (int i = 0; i < list; i++)
input.add(r.nextInt(list + 1));
System.out.print("Input: ");
for (int number : input)
System.out.print(number + " ");
System.out.print("\n\nOutput: ");
for (int number : selectionsort(input))
System.out.print(number + " ");
}
```

If somebody could give me some advice/help then that would be great.

Thanks in advance!