Question: /* Selection sort: We need a function that accepts an array of integers and its size and the starting index and returns the index of

/* Selection sort: We need a function that accepts an array of integers and its size and the starting index and returns the index of the smallest starting at that index. int findIndexSmallest(int A[], int size, int start); Once we have this function then we can use it in the sort function void selectionSort(int A[], int size) { //how many steps? size -1 steps. You think about a for loop that loops size -1 times loop{ // find the index of the smallest strating at i call it indexSmallest. Use the previous //function //swap element at index i with element at index indexSmallest } } int main() { //declare and array of 10 integers //have a loop to read the numbers from the user //display the array before sorting //call selectionSort function //display the array after sorting. } */

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!