Keep track of the lowest numbers in an array

前端 未结 4 1498
旧巷少年郎
旧巷少年郎 2021-01-29 12:57

I am trying to keep track of the the scores of the lowest numbers and if I find the lowest scores of those players I don\'t want them to play again in the next round. I have got

4条回答
  •  心在旅途
    2021-01-29 13:23

    Unless this is homework, you should just have an Object for each player and score. You can add them to a PriorityQueue to always get the lowest or add them to a Collection/array[] and call sort().

    You may want to keep just one copy, but that makes more work for yourself and only saves the computer a milli-second at most.

    Your time is worth more than the computers most of the time.

提交回复
热议问题