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))
(define (trivialsort vals) (lambda (i) i))
No comments yet.