Currently the best sorting algorithm for sorting integer is counting sort.
Snippet
Note : This sort from the smallest value to the largest value
to sort from largest to smallest value, simply change .@out[.@size -1] into .@out[.@total - .@size]
I have used in
1. Reward to the guild captured most flags, or have highest score (outdated - still using comb-sort)
2. Reward to the players kill the most monsters (script)
And the best sorting algorithm to sort strings is comb sort.
Snippet
This one sort the string alphabetically, A-Z
I have use in ....
NONE
I prepared this function, but never find any chance to use it
because most of the time when needed to sort alphabets, it was done in SQL, in a large table
External Links:
Merge sort algorithm improvement - Credit to Keyworld and Haru for helping me ~meko's Array manipulation functions
No comments:
Post a Comment