Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problems 1 4 Write down the results of the codes in Figures 1, 2, 3, and 4. You

ID: 3865322 • Letter: P

Question

Problems 1 4 Write down the results of the codes in Figures 1, 2, 3, and 4. You should specify the result of each problem clearly Problem 5 Write a function that takes in inputs int *p, int n, where p is (points to) an array of size n You can assume that the array has been generated correctly. The function outputs (returns) an integer that is suppose to be the sum of the min element and the max element For example, if the array is 1,2,3, 4,5,6], then the min element is 1, and the max element is 6. So for this case, you general problem, not just this particular instance. ir function should return 7. f course, your function needs to solve the Write a boolean function that determines whether an array is symmetric or not. The function gets inputs int p and i, where p is a pointer to an array of size n. The function determines whether the array is symmetric. You can add inputs to the function of your own choice. (This is not necessary) Any method that correctly solves the problem is acceptable Recall that the definition of symmetric: an array is symmetric if it is the same whether you read from the top or from the end. E.g. [1,2,3,2, 1] is symmetric, but 1,2, 3, 2] is not You should name these functions and specify their inputs and outputs. Please do not name the functions with bad tastes.

Explanation / Answer

double getMinMaxAvg(int *p, int n) {
   int min, max, i;
   double avg;
   min = max = *p;
   for (i = 1; i < n; i++)
       if (p[i] > max)
           max = p[i];
       else if (p[i] < min)
           min = p[i];
   avg = (max + min) / 2;
   return avg;
}

bool isSymetric(int *p, int n)
   int i;
   for (int 0; i < n/2; i++)
       if (p[i] != p[n - 1 - i])
           return false;
   return true;
}

This is solution to problem 5. You are requested to post 1 problem at a time since according to chegg protocol we are supose to answer 1 question at a time. :( I hope you understand

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote