Recursive Thinking—Trees You live in B-land where the King is named B. The King has two advisers. Each of these advisers has two other advisers and so on. Everyone in the village has two advisers...


Recursive Thinking—Trees



You live in B-land where the King is named B. The King has two advisers. Each of these advisers has two other advisers and so on. Everyone in the village has two advisers except the peasants. Everyone in the village advises exactly one person, except the King who advises nobody. The peasants have no advisers (but each advises one other person). The name of a person’s two advisers is public knowledge.



Design recursive algorithms to:


• count the number of peasants in B-land.


• count the total number of people in B-land.


• list the names of everyone in B-land.

Nov 21, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here