by squeaky-clean · 3y ago · 0 comments
is just as fast as
[9]
If you really want to make it strictly constant time, just append INT32_MAX to the end of the array before sorting, and then pop it after.
A subproblem also considers the elements to be integers, then they become another "value" domain. (But in general, sorting problems only need their elements to be comparable, not necessarily integers.)