Add new overview + exercise files + update last week's examples
This commit is contained in:
@@ -32,7 +32,7 @@ with 2nd-degree connections in the second inner list, and so forth.
|
||||
Your algorithm should take a starting person and a *maximum N*, such that your
|
||||
algorithm does not return connections past the maximum Nth connection.
|
||||
|
||||
Example: `nthDegreeConnections(Mallory, 2)` would return the following lists
|
||||
Example: `nth_degree_connections(Mallory, 2)` would return the following lists
|
||||
in a list:
|
||||
|
||||
- `[Carol, Grace]`: 1st-degree connections
|
||||
@@ -55,15 +55,27 @@ Your algorithm should take the starting and ending points, and return a list
|
||||
of tuples. Each tuple should contain the traversal from point A to point B,
|
||||
followed by the total weight.
|
||||
|
||||
In this fictitious graph, calling `possiblePaths("Santa Ana", "San Francisco")`
|
||||
In this fictitious graph, calling `possible_paths("Santa Ana", "San Francisco")`
|
||||
should yield the return below. Which path is better?
|
||||
|
||||
```python
|
||||
graph = {
|
||||
"Santa Ana": [("Los Angeles", 5), ("Palm Springs", 50)],
|
||||
"Los Angeles": [("San Francisco", 25), ("Santa Ana", 5)],
|
||||
"Palm Springs": [("San Francisco", 30), ("Santa Ana", 50)],
|
||||
"San Francisco": [("Los Angeles", 25), ("Palm Springs", 30)]
|
||||
'Santa Ana': {
|
||||
'Los Angeles': 5,
|
||||
'Palm Springs': 50
|
||||
},
|
||||
'Los Angeles': {
|
||||
'San Francisco': 25,
|
||||
'Santa Ana': 5
|
||||
},
|
||||
'Palm Springs': {
|
||||
'San Francisco': 30,
|
||||
'Santa Ana': 50
|
||||
},
|
||||
'San Francisco': {
|
||||
'Los Angeles': 25,
|
||||
'Palm Springs': 30
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user