In O(n^2 ) we can do. But in O(n) i don't get any idea. If any one got the idea just explain.
On Friday, 27 July 2012 15:35:24 UTC+5:30, Navin Kumar wrote: > > Given array of integers (0 or +ve or -ve value) find two elements having > minimum difference in their absolute values. > e.g. Input {10 , -2, 4, 9,-20,17,-8,14,12) > output {9,-8} > > I have solved it in O(nlogn). can it be solved in O(n). > -- 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/-/viXnfcSJGZgJ. 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.