I am sorry for my silly mistake. It is NOT a-b / n-1 its just a-b. apologies

On Fri, Apr 1, 2011 at 6:45 PM, Ashim Kapoor <[email protected]> wrote:

>
>
> On Fri, Apr 1, 2011 at 6:02 PM, snehal jain <[email protected]> wrote:
>
>> For a set S of n real numbers, a pair of elements x, y belong to S,
>> where x < y, are said to be close if
>> y – x <= ( max(S) – min(S) ) / (n-1)
>> Suppose you are given an unsorted array A[1 : n] of distinct real
>> numbers. Design an algorithm that finds a pair of close numbers in A
>> in O(n) time.
>>
>>
> Take any 2 no.s a and b say 1st and 2nd then a-b <= max(S) - min(S)
>
> divide by n-1
>
> (a-b) / (n-1) <= (Max - min) /(n-1)
>
> Solution : Any 2 no.s will do
>
> Am I incorrect somewhere ?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to