Reputation: 11
An unsorted list of n numbers, find any two numbers among the list having minimum difference. If i'll have to write an algorithm for this, with worst case-time O(nlogn)
. Can the following algorithm work:
Is the time complexity for such algorithm will be: O(nlogn + n)
which I can say O(nlogn)
?
Upvotes: 1
Views: 237