开发者

sortedArrayUsing and NSComparison Result : I don't understand how these are actually going about sorting

We're looking at different methods to sort the objects/elements in an array, the thing that doesn't make sense to me is how the actual sorting is done. I guess the big point of confusion is how can the "sort" method be effective 开发者_如何学运维if it only compares one object against another?

If there are values a, g, b, d, z, s, h in the array im not getting how the algorithm is getting this list into say alphabetical order by looking at two values at a time.

Any illumination would be great.


Here's short visualization of quick sort algorithm: http://upload.wikimedia.org/wikipedia/commons/6/6a/Sorting_quicksort_anim.gif

Other than that you can read about sorting algorithms and their inner workings on the internetz: http://en.wikipedia.org/wiki/Sorting_algorithm

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜