Question Problem 2: Figure 7.16 in the textbook (slide 39 / lesson 07 of the generic slides) shows a program that sorts an array. It is incomplete as it lacks the definition of the get_min_range function. Complete the get_min_range function to make the program work to sort the array specified in the main program. #include <stdio.h> #define ARRAY_SIZE 8 Il finds the position of the smallest element in the subarray // list[First] through list[last]. // Pre: first < last and elements 0 through last of array list are defined. // Post: Returns the subscript k of the smallest element in the subarray; // i.e., list[k] <= list[i] for all į in the subarray int get min range (int list[], int first, int last) { /* complete the function here } Il sorts the data in array list void select sortint list[], int n) { int fill, /* index of first element in unsorted subarray */ temp. /* temporary storage *1 index of mio: /* subscript of next smallest element */ for (fill = 0; fill <n-1; ++fill) { /* Find position of smallest element in unsorted subarray */ index of min = get..min.cange (list, fill, n-1); /* Exchange elements at fill and index of min */ if (fill != index of min) { temp = list[index of mio); list[index of mio] = list[fill]; list[fill] = temp; int main (void) { int array( = {67, 98, 23, 11, 47, 13, 94, 58}; int i; select..sort (array, ARRAY_SIZE); for (i=0; i < 8; ++i) printf ("%d", array[i]); return (0);

GFREC5 The Asker · Computer Science

Transcribed Image Text: Problem 2: Figure 7.16 in the textbook (slide 39 / lesson 07 of the generic slides) shows a program that sorts an array. It is incomplete as it lacks the definition of the get_min_range function. Complete the get_min_range function to make the program work to sort the array specified in the main program. #include #define ARRAY_SIZE 8 Il finds the position of the smallest element in the subarray // list[First] through list[last]. // Pre: first < last and elements 0 through last of array list are defined. // Post: Returns the subscript k of the smallest element in the subarray; // i.e., list[k] <= list[i] for all į in the subarray int get min range (int list[], int first, int last) { /* complete the function here } Il sorts the data in array list void select sortint list[], int n) { int fill, /* index of first element in unsorted subarray */ temp. /* temporary storage *1 index of mio: /* subscript of next smallest element */ for (fill = 0; fill
More
Transcribed Image Text: Problem 2: Figure 7.16 in the textbook (slide 39 / lesson 07 of the generic slides) shows a program that sorts an array. It is incomplete as it lacks the definition of the get_min_range function. Complete the get_min_range function to make the program work to sort the array specified in the main program. #include #define ARRAY_SIZE 8 Il finds the position of the smallest element in the subarray // list[First] through list[last]. // Pre: first < last and elements 0 through last of array list are defined. // Post: Returns the subscript k of the smallest element in the subarray; // i.e., list[k] <= list[i] for all į in the subarray int get min range (int list[], int first, int last) { /* complete the function here } Il sorts the data in array list void select sortint list[], int n) { int fill, /* index of first element in unsorted subarray */ temp. /* temporary storage *1 index of mio: /* subscript of next smallest element */ for (fill = 0; fill
Community Answer
GBSECU

Here is the completed code for this problem.Comments are included, go through it, learn how things workand drop a comment in case of any doubts regarding the solution.Thank you.#include&lt;stdio.h&gt;#define ARRAY_SIZE 8//required method, completed.int get_min_range(int list[], int first, int last){ //initially storing first as index of smallest value int index=first; //looping from next index to last for(int i=first+1;i&lt;=last;i++){ //checking if item at i is smaller than item at index if(list[i]&lt;list[index]){ //setting i as new index index=i; } } //returning index of smallest value in the given range. ... See the full answer