【发布时间】:2016-08-12 13:00:24
【问题描述】:
假设我有一个字典数组:
[ { "id": 2 }, { "id": 59 }, { "id": 31 } ... ]
我怎样才能对它进行排序,使其按降序排列,按“id”排序?
我最初的方法是这样的:
Loop through each element, find the biggest one, and put it into a new array. Then, remove that from the element. Repeat.
但我知道这是错误的,而且效率不高。
【问题讨论】:
-
有大量的排序相关信息here