Backtracking is a powerful strategy, and yes if can become exponential even with pruning, but remember that exponential might still be acceptable depending on the size of the input. For instance, in this case there isn't a lot of pruning and the solution ends up being N^4, but N = 15 in this case which is about 50K iterations which is for all practical purposes a "linear" sol...
Receive updates from Another Casual Coder for free, starting right now.
We can deliver them by email, via your phone or you can read them from a personalised news page on follow.it.
This way you won't miss any new article from Another Casual Coder. Unsubscribe at any time.
Site title: Another Casual Coder
