Question: The Zeroing Problem takes in an array of size n and returns an array of the same size containing all zeros. Prove that the algorithm

The Zeroing Problem takes in an array of size n and returns an array of the same size containing all zeros. Prove that the algorithm below correctly solves the zeroing problem for all arrays of size n 1. Hint: you will need strong induction.

Input: data: array of n integers

Input: n: size of data

Output: an array containing n zeros

1 Algorithm: RecursiveZero

2 if n = 1 then

3 data[1] = 0

4 else

5 mid = [n/2]

6 data[1..mid] = RecursiveZero(data[1..mid])

7 data[mid + 1..n] = RecursiveZero(data[mid + 1..n])

8 end

9 return data

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!