Question: Write a function that finds the smallest element in an array from a starting position to the end of the array . The function's prototype

Write a function that finds the smallest element in an array from a starting position to the end of the array . The function's prototype is findMin(int a[], int size, int start);

Use the findMin function to write the following sort function:

The Selection sort finds the position of the smallest element in the unsorted part of the array and exchanges it with the last element in the sorted part of the array. Once at its correct position in the sorted part of the array, an element never moves again.

SelectionSort(A, Size)

for sorted := 0 to Size 2

min := find minimum from (sorted, size - 1

if min sorted then

swap(A[min], A[sorted]

end if

end for

end SelectionSor

t

*Note: I need help to write out this problem in C++ while using Visual Studio 2017

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 Databases Questions!