Question: We are given an array A of n distinct positive numbers in sorted ( ascending ) order. ( Assume n is a power of 2

We are given an array A of n distinct positive numbers in sorted (ascending) order. (Assume n is a power of 2.) The minimum distance in such an array is defined as the distance between a closest pair of numbers stored in the array.
Consider the following algorithm to find the minimum distance in such an array.
Split the array into two equal halves, find minimum distances in each, and then take the minimum of the two.
Will this work correctly? Fix it if not.

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!