|
|
|
|
|
by Karliss
1158 days ago
|
|
I don't se how stable sort would help preserving input order when deduplicating uint64. Stable sorting preserves the order of "identical" elements. It's only useful if the elements have other distinguishable properties which are not taken into account for sorting order. For a list of plain uin64 sort and stable sort would produce the same output. Even if you attached some other information to distinguish them, for the purpose of deduplicating you want the values with the same key to be in sequence. Stable sort could help you to choose whether you keep the first or last of the duplicate, but the initial order of unique elements would be lost just like with regular sort. |
|
Edit: I see now that the original article meant preserving output order. And i have not clarified that i meant input order.