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

is anyone possible give me advice how I have to prove this by induction and proo

ID: 3667232 • Letter: I

Question

is anyone possible give me advice how I have to prove this by induction and proof by conttadiction?? I have to do with this find max function I understand how this function work but still not sure how to prove it..


c) There exists no integer a and b for which 21 a +30-1. d) Ifx54x4 + 3x3-2.2 + 3x _ 4 > 0 , then x > 0 es i ( . Problem 2. (20 points) Assume a simplified version of project 1 where grades for each assignment are stored in an one dimensional array. Use (i) induction and (ii) proof by con- tradiction to prove the correctness of the following C function which finds the maximum grade in the given array of n elements. Show the induction steps. 1 float find.max(float arr, int n) 1 float find.max (float *arr, int n)f float maxar float max* arr; for (int i = 0; i max max = *(arr + i); return max; Problem 3. (10 points each) Use induction to prove the following: 4

Explanation / Answer

Precondition: like base case.
CurrentMax = arr[0] or arr.

Loop invariant(Induction Step): if true at step i, still true
after one more loop.
Suppose CurrentMax is the max of arr[0..i- 1].
Two cases:
   a) arr[i]> CurrentMax. Then CurrentMax is the max of A[0..i] since it is in the array
       (arr[i]) and it is the largest (> than previous).
   b) arr[i] is not > than CurrentMax. Then CurrentMax is the max of arr[0..i] since it
       was the max of arr[0..i- 1] and arr[i] is not bigger.
      
By induction, true for all iterations including
termination.