

solve( n ) { Sol s1, s2, s3, ...; Sol sol; /* ================================================= Take care of the "base cases" seperately (this will stop the "infinite recursion" problem ================================================== */ if ( n == a base_case ) { return ( base_case_solution(n) ); // Base case } /* =================================================== This is the recursive solver =================================================== */ /*  Solve smaller problems (divide step)  */ s1 = solve( n1 ); // s1 = the solution of smaller problem "n1" s2 = solve( n2 ); // s2 = the solution of smaller problem "n2" s3 = solve( n3 ); // s3 = the solution of smaller problem "n3" .... /*  Use the solutions for the smaller problems to solve the ORIGINAL problem (conquer step)  */ sol = combine( s1, s2, s3, ..... ); /*  Return the solution...  */ return (sol); } 