if(basecase1)// return some simple expressionelseif(basecase2)// return some simple expressionelseif(basecase3)// return some simple expressionelseif(recursivecase1){// some work before // recursive call // some work after }elseif(recursivecase2){// some work before // recursive call // some work after }else{// recursive case 3 // some work before // recursive call // some work after }
if(basecase1){// return some simple expression}elseif(basecase2){// return some simple expression}elseif(basecase3){// return some simple expression}elseif(recursivecase1){// some work before // recursive call // some work after }elseif(recursivecase2){// some work before // recursive call // some work after }else{// recursive case 3 // some work before // recursive call // some work after }
if (base case 1)
// return some simple expression
else if (base case 2)
// return some simple expression
else if (base case 3)
// return some simple expression
else if (recursive case 1) {
// some work before
// recursive call
// some work after
}
else if (recursive case 2) {
// some work before
// recursive call
// some work after
}
else { // recursive case 3
// some work before
// recursive call
// some work after
}