Question: help me fix this this is the question Section B: Finding Maximum Write a recursive function that has a parameter representing a list of integers

help me fix this this is the question

Section B: Finding Maximum

Write a recursive function that has a parameter representing a list of integers and returns the maximum stored in the list. Thinking recursively, the maximum is either the first value in the list or the maximum of the rest of the list, whichever is larger. If the list only has 1 integer, then its maximum is this single value, naturally.

Section C: Sort

Write a recursive function that will sort a list of integers from the smallest to the largest. The result will be stored in an output array. You will also utilize the maximum function of part (b).

#include

int maxi(int[]); int size;

void swap(int* x, int* y) { int temp = *x; *x = *y; *y = temp; } // Function to perform Selection Sort void selectionSort(int arr[], int n) { int i, j, min; // One by one move boundary of unsorted subarray for (i = 0; i < n - 1; i++) { // Find the minimum element in unsorted array min = i; for (j = i + 1; j < n; j++) if (arr[j] < arr[min]) min= j; // Swap the found minimum element // with the first element swap(&arr[min], &arr[i]); } }

void printArray(int arr[], int size) { int i; for (i = 0; i < size; i++) printf("%d ", arr[i]); printf(" "); }

int main(void) { int i, ary[10], maxv;

printf("Please Enter The Size of Array:"); scanf("%d",&size); printf("%d elements entered ",size); 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!