Question: Selectionsort.C codes: #include #define SIZE 8 void printArray(int arr[]); void printArray(int arr[]) { int i; for(i=0; i void selectionSort(int arr[]); void selectionSort(int arr[]) { int

Selectionsort.C codes: #include #define SIZE 8 void printArray(int arr[]); void printArray(int arr[])Selectionsort.C codes:

#include #define SIZE 8 void printArray(int arr[]); void printArray(int arr[]) { int i; for(i=0; i

void selectionSort(int arr[]); void selectionSort(int arr[]) { int i, j, temp, min_index; for(i=0; i

main() { int arr[SIZE] = {5,3,1,9,8,2,4,7}; printf("Array before sort: "); printArray(arr); selectionSort(arr); printf("Array after sort: "); printArray(arr); system("PAUSE"); }

QUESTION 3 Retrieve the Selectionsort.c program coded during lecture class. Modify the codes to cater for the additional system requirements. The additional system requirements are: . Reset constant SIZE to 10. In main : Call function generate Array(...), passing array arr as parameter before printing the array before sort. Call function determine MinMax(...), passing array arr as parameter after printing the sorted array In generateArray(); Generate ten (10) random members into the array arr. Ensure that each time the program runs, a different set of random mumbers are generated In determine Min Max(): Display the smallest and largest member in array arr. Sample output screen Array before sort 19642 2381 21056 4e27 28074 4225 12686152 19124 38560 Array after sort; 1268 2381 4827 42250152 19124 19642 28974 21956 38509 :: SMALLEST NUMBER LARGEST NUMBER 1268 30569 (a) Draw the flowchart for function generate Array(...). (5 marks) (b) Draw the flowchart for function determine MinMax (...). (5 marks) (d) Write the complete C program (20 marks) (Total: 30 marks) int i; main.c 1 #include 2 #define SIZE 8 3 void printArray (int arr[]); 4 void printArray(int arr[]) 5- { 6 7 for(i=0; i

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!