Question: We are given a sorted array A[a..n] of arbitrary real numbers. For each I [1..n-1], we call A[i+1]-A[i] the i-th gap of A. Note that

We are given a sorted array A[a..n] of arbitrary real numbers. For each I [1..n-1], we call A[i+1]-A[i] the i-th gap of A. Note that there are n-1 gaps

a) The average gap of A is the average of the n-1 gaps of A. How fast can you compute the average gap of A? How?

b) By the law of averages there must be some I [a..n-1] such that the i-th gap of A does not exceed the average gap of A we call any such i-th gap a short gap. The problem is to find a short gap of A. There is an obvious O(n) time algorithm that checks each gap and picks the shortest one. Describe a asymptotically faster divide-and-conquer algorithm to find a short gap of A.

c) Explain the correctness of your algorithm in part(b)

d) Analyze the running time of your algorithm in part(b)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To solve this problem we need to address each part thoroughly considering computational complexity a... View full answer

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!