Throwing the fattest people off of an overloaded airplane.

后端 未结 12 1737
迷失自我
迷失自我 2020-12-04 04:42

Let\'s say you\'ve got an airplane, and it is low on fuel. Unless the plane drops 3000 pounds of passenger weight, it will not be able to reach the next airport. To save t

12条回答
  •  半阙折子戏
    2020-12-04 05:31

    Why don't you use a partial quicksort with a different abort rule than "sorted". You can run it and then use just the higher half and go on until the weight within this higher half does not contain the weight that has at least to be thrown out anymore, than you go back one step in the recursion and sort the list. After that you can start throwing people out from the high end of that sorted list.

提交回复
热议问题