Is it possible to find two numbers whose difference is minimum in O(n) time

后端 未结 8 714
日久生厌
日久生厌 2020-12-04 20:05

Given an unsorted integer array, and without making any assumptions on the numbers in the array:
Is it possible to find two numbers whose difference is minimum i

8条回答
  •  悲哀的现实
    2020-12-04 20:39

    No, not without making assumptions about the numbers/ordering.

    It would be possible given a sorted list though.

提交回复
热议问题