main.java
//it will sort the given int array and return an instance of that array for ease of testing
it will sort the given int array and return an instance of that array for ease of testing
it will sort the given int array and return an instance of that array for ease of testing
public static int[] select_sort(int[] list) {
        int length = list.length;
        int index = 0;
        for(int x = 0; x < length - 1; x++) {
            int min =list[x];
            for (int i = x + 1; i <length; i++) {
                if(list[i]<min) {
                    min = list[i];
                    index = i;
                }
            }
            int swap_val = list[x];
            list[x] = min;
            list[index] = swap_val;
        }
        return list;
    }
public static int [ ] select_sort ( int [ ] list ) { int length = list . length ; int index = 0 ; for ( int x = 0 ; x < length - 1 ; x ++ ) { int min = list [ x ] ; for ( int i = x + 1 ; i < length ; i ++ ) { if ( list [ i ] < min ) { min = list [ i ] ; index = i ; } } int swap_val = list [ x ] ; list [ x ] = min ; list [ index ] = swap_val ; } return list ; }
it will sort the given int array and return an instance of that array for ease of testing
it will sort the given int array and return an instance of that array for ease of testing
//initial variables length is use for forloop limit and index will hold the index of smallest item //we go through the array every time initializing the current item as the smallest // we start looping through the list again starting at the index right after current x // we find the smallest item and save its  value and index //we swap the current value at index x with the smallest value and the value at x goes to index of the samllest value // return a list for ease of testing