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 <jagadis...@gmail.com> 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 > > > > On Jun 27, 5:55 pm, sharad kumar <sharad20073...@gmail.com> 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 algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > 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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.