Question: Write a program that uses recursive backtracking to find all ancestors and descendants of a person given a file of familial relationships. For ancestors it

Write a program that uses recursive backtracking to find all ancestors and descendants of a person given a file of familial relationships. For ancestors it must show all parents, all grandparents, all great grandparents, etc. For descendants it must show all children, all grandchildren, all great grandchildren, etc. The program also must use indentation to make it clear who is a parent of whom and who is a child of whom. Write two recursive methods that use backtracking to explore for ancestors and descendants respectively. Here is a possible example dialogue:

Input file? tudor.dat Whose info? Margaret Ancestors: Margaret Elizabeth of York Henry VII Descendants: Margaret James V Mary, Queen of Scots James VI & I Margaret Stuart Henry, Lord Darnley James VI & I

Input file? tudor.dat Whose info? Margaret Ancestors: Margaret Elizabeth of York Henry VII Descendants: Margaret James V Mary, Queen of Scots James VI & I Margaret Stuart Henry, Lord Darnley James VI & I

Step by Step Solution

3.41 Rating (164 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

public class FamilyInfo private ArrayList people private final String LISTEND END signals end of list post constructs an empty family list public FamilyInfo people new ArrayList post returns the posit... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Building Java Programs A Back to Basics Approach Questions!