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 view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/-ac6LuuRRQkJ. 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.