TORONTO KIDS COMPUTER CLUB | Markham Saturday 14:00 Java Homework 21.04.24.
19328
post-template-default,single,single-post,postid-19328,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.8.0,vc_responsive

Markham Saturday 14:00 Java Homework 21.04.24.

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

No Comments

Sorry, the comment form is closed at this time.