Suppose we modify the code in Figure 5 by adding the following lines immediately after line 15:
This modification is suggested in the text and avoids examining any sequence that begins with a negative number.
a. If all the numbers in the array are positive, what is the running time of the resulting algorithm?
b. If all the numbers in the array are negative, what is the running time of the resulting algorithm?
c. Suppose all the numbers are integers uniformly and randomly distributed between –50 and 49, inclusive. Write a test program toobtain timing data, going up to N = 10,000,000. Can you infer the running time of the program in this unique circumstance?
d. Now suppose all the numbers are integers uniformly and randomly distributed between –45 and 54, inclusive. Does that significantly affect the running time?
e. Suppose all the numbers are integers uniformly and randomly distributed between –1 and 1, inclusive. Does that significantly affect the running time?