Identify recursive thinking in a specified problem solution.


Teaching Note:

LINK Binary trees.


Sample Question:


JSR Notes:

So here, you would be given a real-life or programming situation, and be asked to spot the recursive solution - which, at one level is pretty easy; just look for another instance of a particular method being called within one of the same name.

This Java Revolution page "Iteration 4: Recursion" has the best notes for the "why" of recursion - particularly near the bottom, plus a couple of coded examples, which includes part of a binary tree traversals section:

103    notes  Iteration 4: Recursion (***entirely new notes***)


To go up to the next level of sophistication is really taking us into the OOP Option. But I'll repeat all the links here too:

Here's the animation for the (recursive) traversal of a binary tree (binary tree is refereed to in the notes). And, as mentioned in 5.1.1, really, that's the only real, appropriate, necessary, application of recursion that we have seen/coded in the course.

And full code links for the binary search tree, with its recursive traversals:

2222      code  Binary Search Tree and Node Class Code
2223      code  Specific Binary Search Tree Implementation 

Explanation of recursive traversals (among more details)

2210     notes  Binary Search Trees - Traversing Recursively                                   
2212 animation (of binary search tree traversal)