Add new overview + exercise files + update last week's examples

This commit is contained in:
2026-08-03 15:40:07 -07:00
parent fafa36aad3
commit da7acf5f78
4 changed files with 75 additions and 6 deletions

View File

@@ -0,0 +1,28 @@
# see the overview from 2026.07.31
sample_graph = {
'Alice': set(['Bob', 'Carol']),
'Bob': set(['Alice', 'Dave']),
'Carol': set(['Alice', 'Eve', 'Mallory']),
'Dave': set(['Frank', 'Eve', 'Bob']),
'Eve': set(['Carol', 'Grace', 'Dave']),
'Frank': set(['Dave', 'Heidi']),
'Grace': set(['Eve', 'Ivan', 'Mallory']),
'Heidi': set(['Frank', 'Ivan']),
'Ivan': set(['Heidi', 'Grace']),
'Mallory': set(['Carol', 'Grace'])
}
def nth_degree_connections(
graph: dict[str, set[str]],
starting_vertex: str,
max_n: int
):
# TODO
pass
print(nth_degree_connections(sample_graph, 'Mallory', 2))
print(nth_degree_connections(sample_graph, 'Alice', 4))
print(nth_degree_connections(sample_graph, 'Ivan', 1))
print(nth_degree_connections(sample_graph, 'Grace', 0))
print(nth_degree_connections(sample_graph, 'Carol', 100))

View File

@@ -0,0 +1,26 @@
# see the overview from 2026.07.31
sample_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
}
}
def possible_paths(start: str, end: str):
# TODO
pass
print(possible_paths('Santa Ana', 'San Francisco'))

View File

@@ -0,0 +1,3 @@
## Outline
Let's work on the exercises from [last week](../2026.07.31/overview.md).