Question: Program 3: Find the smallest element in the array and put it in the sorted array until the entire array is completely sorted. Java file

Program 3: Find the smallest element in the array and put it in the sorted array until the entire

array is completely sorted. Java file name must be SelectionSort

Public class SelectionSort

{

static void sel_sort(int numArray[])

{

// implement the sorting options here. How you'd be find the smallest number in the array

and create a temp array to store the sorted array.

}

}

public static void main(String args[])

{

//declare and print the original array

int numArray[] = {7,5,2,20,42,15,23,34,10};

System.out.println("Original Array:" + Arrays.toString(numArray));

//call selection sort routine

sel_sort(numArray);

//print the sorted array

System.out.println("Sorted Array:" + Arrays.toString(numArray));

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!