Recursion is an advanced programming technique that is known to lead to elegant programs, but whose usefulness is sometimes questionable because most recursive programs can be rewritten easily in a non-recursive manner. The one example where the efficiency of recursion really stands out is traversing binary trees. Therefore we prepared a short video that shows a relatively simple recursive program for Karel the Robot, that uses recursion to traverse an arbitrary binary tree of apples. Enjoy!
11/26/2023