Question: 2 . 2 N - th Cousin Write the function nth _ cousin ( name 1 , name 2 , tree ) to find the

2.2 N-th Cousin
Write the function nth_cousin(name1, name2, tree) to find the value n such that name1 is the n-th cousin of name2(and vice versa since the relationship is symmetric). If they are not n-th cousin, return -1. Remember, the smallest value of n is 1 if they are cousin.

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 Programming Questions!