‹ Back to the paper
Question 2
2 marks
Computer ScienceISC 2022 Computer Science - Specimen paper (Semester 2), Paper 1DifferentiateRecursion
Differentiate between the following.
Differentiate between direct recursion and indirect recursion.
Answer
Answer
Direct recursion: a function calls itself directly, e.g. int f(int n) { ... f(n-1) ... }.
Indirect recursion: a function calls another function, which in turn calls the first function back, e.g. A() calls B() and B() calls A().