Getting Top 10 Highest Numbers From Array?

后端 未结 5 1309
轮回少年
轮回少年 2021-01-24 23:00

I am having a bit of a issue. I have an NSMutableDictionary with 10 NSMutableArrays in it. Each array has somewhere between 0-10 numbers which could each be any integer, e.g. 12

5条回答
  •  借酒劲吻你
    2021-01-24 23:32

    It seems as if the data structure you want to end up with is an array of objects, where each object is functionally similar to an "index path" except that it's composed of a string (key) and a value (offset).

    Assuming that the actual search for highest numbers isn't in question, then I'd suggest creating one of these objects whenever you find a candidate number so that, once the top ten are found, the objects can be used as back-pointers to the numbers' source locations.

提交回复
热议问题