answersLogoWhite

0

1- Repeat step 2 and 3 varying j from 0 to n-2

2- Find the index at the minimum value in arr[j] to arr[n-1]

a- set min_index = j

b- repeat step c varying i from j+1 to n-1

c- if arr[i] < arr [min_index]:

1- min_index = i

3-swap arr[j] with arr[min_index]

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

What is the Big O notation of the selection sort algorithm?

The Big O notation of the selection sort algorithm is O(n2), indicating that its time complexity is quadratic.


Which sorting algorithm is more efficient for large datasets: quick sort or selection sort?

Quick sort is more efficient for large datasets compared to selection sort.


Which sorting algorithm is more efficient for small datasets: bubble sort or selection sort?

Selection sort is more efficient for small datasets compared to bubble sort.


In a selection sort when changing from ascending to descending order only---------- modifications need to be made to the algorithm?

Change every "&lt;" to "&gt;" and "&gt;" to "&lt;" .


How do you implement selection sort in c with graphics?

Selection sort has the following implementation: // sort an array if integers of length size in ascending order using selection sort algorithm: void selection_sort (int a[], unsigned size) { unsigned i, max; while (size &gt; 1) { max = 0; for (i=1; i!=size; ++i) if (a[i] &gt; a[max]) max = i; swap (a[max], a[--size]); } }


Who invented insertion sort?

There are no records of when insertion sort was invented because people have been sorting things using the insertion sort and selection sort algorithms since before records began; they are ancient algorithms. You cannot be credited for creating an algorithm that already exists. Shell sort, which is a refinement of insertion sort, was developed much later, in 1959 by Donald Shell. His algorithm can be credited because it takes advantage of a computer's processing abilities, whereas insertion sort and selection sort rely purely on a human's processing abilities.


Is Quick Sort an in-place sorting algorithm?

Yes, Quick Sort is an in-place sorting algorithm.


Is bubble sort a stable sorting algorithm?

Yes, bubble sort is a stable sorting algorithm.


Is radix sort an in-place sorting algorithm?

Yes, radix sort is an in-place sorting algorithm.


What is algorithm to write algorithm to the program to access a pointer variable in structure?

Here is the algorithm of the algorithm to write an algorithm to access a pointer in a variable. Algorithmically.name_of_the_structure dot name_of_the _field,eg:mystruct.pointerfield


What is the worst case and best case of bubble sort?

There is no worst case for merge sort. Each sort takes the same amount of steps, so the worst case is equal to the average case and best case. In each case it has a complexity of O( N * log(N) ).


Write an algorithm to find the root of quadratic equation?

Write an algorithm to find the root of quadratic equation