Difference between backtracking and recursion?

前端 未结 7 692
长发绾君心
长发绾君心 2021-01-30 01:47

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);
         


        
7条回答
  •  情话喂你
    2021-01-30 02:36

    recursion - no values abandoned;

    backtracking - abandon some solution candidates;

    also note that backtracking will call itself more than once in the body of function, while it's not normally true for recursion

提交回复
热议问题