3 ms·
My personal favorite has always been permutation sort, where you try all possible permutations of a sequence and check if it is sorted. What's nice about it is
by ginkgo 15y ago
My personal favorite has always been permutation sort, where you try all possible permutations of a sequence and check if it is sorted.
What's nice about it is that it is deterministic yet ridiculously slow.
It can also be really easily implemented in Prolog[1] where you simply define what a permutation and being sorted means. After that you just search for a sorted permutation.
[1] http://rosettacode.org/wiki/Sorting_algorithms/Permutation_sort#Prolog http://rosettacode.org/wiki/Sorting_algorithms/Permutation_s...