Retrieve the two highest item from a list containing 100,000 integers

后端 未结 15 820
心在旅途
心在旅途 2020-12-13 17:55

How can retrieve the two highest item from a list containing 100,000 integers without having to sort the entire list first?

15条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-13 18:28

    Iterating through the entire list is the only way to do it without sorting.

提交回复
热议问题