1
1
# Instructions
2
2
3
3
Your task is to determine the degree of separation between two individuals in a family tree.
4
+ This is similar to the pop culture idea that every Hollywood actor is [ within six degrees of Kevin Bacon] [ six-bacons ] .
4
5
5
6
- You will be given an input, with all parent names and their children.
6
7
- Each name is unique, a child _ can_ have one or two parents.
@@ -13,22 +14,21 @@ Your task is to determine the degree of separation between two individuals in a
13
14
Given the following family tree:
14
15
15
16
``` text
16
- ┌──────────┐ ┌──────────┐ ┌───────────┐
17
- │ Helena │ │ Erdős │ │ Shusaku │
18
- └───┬───┬──┘ └─────┬────┘ └──────┬────┘
19
- ┌───┘ └───────┐ └──────┬──────┘
20
- ▼ ▼ ▼
21
- ┌──────────┐ ┌────────┐ ┌──────────┐
22
- │ Isla │ │ Tariq │ │ Kevin │
23
- └────┬─────┘ └────┬───┘ └──────────┘
24
- ▼ ▼
25
- ┌─────────┐ ┌────────┐
17
+ ┌──────────┐ ┌──────────┐ ┌───────────┐
18
+ │ Helena │ │ Erdős ├─────┤ Shusaku │
19
+ └───┬───┬──┘ └─────┬────┘ └────┬──────┘
20
+ ┌───┘ └───────┐ └───────┬───────┘
21
+ ┌─────┴────┐ ┌────┴───┐ ┌─────┴────┐
22
+ │ Isla ├─────┤ Tariq │ │ Kevin │
23
+ └────┬─────┘ └────┬───┘ └──────────┘
24
+ │ │
25
+ ┌────┴────┐ ┌────┴───┐
26
26
│ Uma │ │ Morphy │
27
27
└─────────┘ └────────┘
28
28
```
29
29
30
- The degree of separation between Tariq and Uma is 3 (Tariq → Helena → Isla → Uma).
31
- There's no known relationship between Isla and [ Kevin] [ six-bacons ] , as there is no connection in the given data.
30
+ The degree of separation between Tariq and Uma is 2 (Tariq → Isla → Uma).
31
+ There's no known relationship between Isla and Kevin, as there is no connection in the given data.
32
32
The degree of separation between Uma and Isla is 1.
33
33
34
34
~~~~ exercism/note
0 commit comments