I have a problem with the second example. An attribute to track the title of an employee would solve the problem of finding the CEO and any other type of employee, this should not be done with recursion. If recursion is such an important concept we should have real-life examples of it being employed properly to lean on.
Also am I missing something or does your findCeo function return the employee when they have a boss and recurse when they have no boss? Seems like this just returns the employee in most cases and infinitely recurses for the CEO who presumably has no boss.
An attribute will only work if you are given a list of employees or other iterable structure.
My real example is that in my day job different business units of our customers are represented by a hierarchy, and you frequently traverse that hierarchy looking for some feature that's derived from the ancestor.
But really this is any algorithm that looks up a tree.
Also am I missing something or does your findCeo function return the employee when they have a boss and recurse when they have no boss? Seems like this just returns the employee in most cases and infinitely recurses for the CEO who presumably has no boss.