4 ms·
The tiniest sort in most other languages: "sort". And it probably runs in not-O(n2) time...
by jrockway 17y ago
The tiniest sort in most other languages: "sort". And it probably runs in not-O(n2) time...
- scott_s 17y agoC99 has a sort function that is a part of the standard library. Clearly, the point of the exercise is not calling a library function, but how most compactly one can express a sort algorithm.
- ajross 17y agoHey, cool. ANSI C89 has a sort function that is part of the standard library too! So does 3BSD! Small world. :) I'm sure qsort() is older than even 3BSD, but that's the oldest source base I have sitting on this box.