Question: C++: Write the function described below Suppose we have some input data describing a graph of relationships between parents and children over multiple generations. The

C++: Write the function described below

C++: Write the function described below Suppose we have some input data

describing a graph of relationships between parents and children over multiple generations.

The data is formatted as a list of (parent, child) pairs, where

Suppose we have some input data describing a graph of relationships between parents and children over multiple generations. The data is formatted as a list of (parent, child) pairs, where each individual is assigned a unique integer identifier. For example, in this diagram and the sample input a child of 1 and 2, and 5 is a child of 4 10 1 2 4 11 \1 1\1 6 7 9 Write a function that. given the dataset and the ID of an individual in the dataset. returns their earliest known ancestor-the one at, the farthest distance from the . input individual. If there is more than one ancestor tied for "earliest" return the one with the towest numeric D. If the input individual has no parents. the function should return 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!