3 ms·
If you must restrict the input to permutations of [0,...,N], you already know the result! Finding cycles is neat, but this works for the same data, minus having
by tsewlliw 16y ago
If you must restrict the input to permutations of [0,...,N], you already know the result! Finding cycles is neat, but this works for the same data, minus having bounds:
(define (trivialsort vals) (lambda (i) i))