What is the difference between backtracking and recursion? How is this program working?
void generate_all(int n)
{
if(n<1) printf("%s\\n", ar);
In my understanding, backtracking is an algorithm, like all the other algorithms, like BFS and DFS, but recursion and also iteration are methods, they are at a higher level than the algorithms, for example, to implement a DFS, you can use recursion, which is quite intuitive, but you can also use iteration with a stack, or you can also think recursion and iteration are just methods to support your algorithms.