@abhirup: I agree with ur idea of sorting and then finding out the difference for the consecutive elements....but counting sort takes the range into account.. I dont think range is given...
On Mon, Jun 28, 2010 at 12:01 PM, Abhirup Ghosh <[email protected]> wrote: > We can sort the array in O(n) time using counting sort. And then take > the difference of consecutive elements in O(n) time to get the minimum > one. > > -Abhirup > > > > On Mon, Jun 28, 2010 at 10:36 AM, Jagadish M <[email protected]> wrote: > > In the general case, we can reduce Element-Distinctness(ED) problem to > > this problem. Since ED has a lower bound of Omega(n log n), we cannot > > get an O(n) algorithm for this problem. > > > > http://en.wikipedia.org/wiki/Element_distinctness_problem > > > > > > -Jagadish > > http://www.cse.iitb.ac.in/~jagadish<http://www.cse.iitb.ac.in/%7Ejagadish> > > > > > > > > On Jun 27, 5:55 pm, sharad kumar <[email protected]> wrote: > >> How to find the two numbers whose difference is minimum among the set of > >> numbers > > > > -- > > 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]<algogeeks%[email protected]> > . > > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > > > > > -- > 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]<algogeeks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- 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.
