25 Apr Markham Saturday 14:00 Java Homework 21.04.24.
Question:
Given an array as below
[6,7,1,3,4,2,9,5]
Sort the above array using selection Sort.
The steps of the selection sort are as below:
arr[] = 64 25 12 22 11
// Find the maximum element in arr[0…4]
// and place it at end of arr[0…4]
11 25 12 22 64
// Find the maximum element in arr[0…3]
// and place it at end of arr[0…3]
11 22 12 25 64
// Find the maximum element in arr[0…2]
// and place it at end of arr[0…2]
11 12 22 25 64
// Find the maximum element in arr[0…1]
// and place it at end of arr[0…1]
11 12 22 25 64
Sorry, the comment form is closed at this time.