Is "recursion" and "backtracking" the same thing or is backtracking a kind of recursion ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is "recursion" and "backtracking" the same thing or is backtracking a kind of recursion ?

Backtracking is usually implemented using recursion. How both of them relate to each other ?

17th Sep 2018, 4:30 PM
Nieb Hasan
Nieb Hasan - avatar
2 Answers
+ 3
Backtracking is a property of an algorithm and recursive function is a way of achieving it ;)
17th Sep 2018, 5:25 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 1
Here's a maze solver where we could name things recursion and backtracking: https://code.sololearn.com/WwI44YsoFHiG/?ref=app Choose "let the program solve". Ask: Recursion: What's special about intersections? What happens there? How is "what happens" related to the task that was just being done? Backtracking: What's special about dead ends? What happens there? ...
17th Sep 2018, 6:51 PM
Kirk Schafer
Kirk Schafer - avatar