开发者

Arithmetic Mode from an NSMutableArray of objects

I have an NSMutableArray of objects and a property per each object which contains a double. I want to get the Arithmetic Mode (most开发者_运维问答 common value) from the NSMutableArray. What is the fastest way of doing this as it is running through a lot of data.


If you add them all at once then probably you will have to iterate over all the values, if you add them one at atime i would calculate the mode while adding.

Or partition the array into subarrays then calculate count of each value of each subarray in its own thread then calculate the mode using the counts. But probably taht will be not really faster than iterating over the array and a lot more complex.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜