5 ms·
Consider the following four combinations of {stable, unique}: - stable sort of unique values is ordering - stable sort of non-unique values is categorization
by dexen 8y ago
Consider the following four combinations of {stable, unique}:
- stable sort of unique values is ordering
- stable sort of non-unique values is categorization + ordering; this is a most general algorithm which could reasonably be used for either operation
- non-stable sort of non-unique values is categorization without ordering
- non-stable sort of unique values technically could be implemented as a NOP.
Given that various strategies of ordering and categorizing have different trade-offs between {memory,computational} complexity, and linear vs random access patterns, it makes sense to consider them pluggable algorithms that can be swapped depending on requirements.