Question

I have this problem on my homework and I don't understand it.

Assume there are four methods A, B, C, and D. Method A calls method B, and method B calls method A. Method C calls method D, and method D calls method A. Which of the following methods is indirectly recursive?

What is indirectly recursive and what isn't?

Was it helpful?

Solution

A -> B -> A <- D <- C

Indirectly Recursive : Method A and B, as they indirectly call themselves by calling each other.

Directly Recursive : None of them as no method calls itself.

See this link for detailed information.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top