A radix sort would provide an O(n) solution for any fixed-size integer data type.
Dave On Oct 10, 10:19 am, sravanreddy001 <sravanreddy...@gmail.com> wrote: > Without sorting the elements we have around n^2 elements to look from, to > find the smalled element. > > But, after sort, we will have only n-1 elements to look from. So, O(nlogn) > is what I see, the best case. > > Is there really a O(n) solution, as finding the diff between elements should > be done comparing will every other. (unsorted) > or selected ones (after sort) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@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.