Re:Brute-forcing a seemingly simple number puzzle
by taeric on Wednesday December 05, 2018 @03:36PM
(#18612256)
Backtracking doesn't require a mutable anything, per se. Just the ability to get back to where you were.
Now, it can be somewhat easily reasoned that a mutable board can more quickly let you go back to previous settings, since you could potentially lose the GC steps of the immutable version.
Of course, the immutable is more easily reasoned for parallelizing, since you can just throw paths to different workers without them stepping on each other.
So, tradeoffs.
Someone correct me if I'm wrong, but I believe backtracking actually requires a mutable array and would be faster (since you wouldn't have to build 100x100 arrays all the time: you could just build the 100x100 array one time and mutate it.)