Every so often during our software development endeavors we might face situations where the solution(s) can be found easily or the job can be done quickly using typical well-known algorithms that can be implemented routinely. This is the first part of a multi-segment series on programming techniques where we briefly present algorithm methods one by one. This time we are going to cover backtracking.
The Backtracking Algorithm Technique - Taking a Break (Page 4 of 4 )
We've come to the end of the first segment of the series. Throughout this article we have covered and focused only on the technique called backtracking. By now we should know what it's all about, when it is the optimal technique to use, and not the least, we also learned how to implement and write code that solves a backtracking problem.
Summing these up, backtracking ought to be used when no other algorithm or method is possible. By this I mean, it should be used in those cases when the problem can be reduced to some variation of the Descartes multiplication of some kind of arrays. Backtracking, due to its nature, isn't the most efficient technique; its run time can be quite high, and its complexity is just as bad. If any other alternative that gives a quicker result is possible, then it should be avoided. But when all of the results must be generated regardless, it does the job.
Don't forget to stick around for the upcoming parts of this series. In the next part we will present an interesting technique that gets its name from Latin: divide et impera. It basically means divide and conquer. It is a really useful algorithm that solves many of the typical problems in a really elegant and simplistic fashion. You see, this is another reason why these five algorithms are popular-elegance and efficiency.
If you have any further questions or require some clarifications then please don't hesitate to join our friendly ever-growing community of professionals, enthusiasts, and experts at DevHardware Forums. We specialize in everything related to hardware, software, and consumer electronics. You might also want to pop into the forums of our sister site called DevShed Forums.
As always, remember: write clear code, practice, and succeed!
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.