I am writing an algorithm to solve what appears to be an NP-complete problem, so naturally I need a brute force algorithm >.< Bearing that in mind, the best solution I have involves an array (wlog) of ints 0-9. I'd like to be able to shuffle those ints around after every step, so that the array reads:
Iteration 1: 0123456789
Iteration 2: 0123456798
9876543210 (which is the final iteration)
Any ideas or pointers?
Complexity is not an issue. I can easily let this program run for ages. Correctness is essential though, so it can be as slow and chunky as it needs so long as it works.