Materials for the practicum for "Fundamentals of Algorithms" course at SpbU
Set up your environment
Go to Run and Debug
in the left panel, create a new launch file, select Python File
and add the following field:
"env": {
"PYTHONPATH": "${workspaceFolder}${pathSeparator}${env:PYTHONPATH}"
}
We study basic tools necessary for the rest of the course: python
, numpy
and matplotlib
. It is assumed that a student has some decent knowledge of python though he/she is not very experienced in it.
Plan:
- Warm-up
- Go through
intro_to_numpy_and_matplotlib.ipynb
together
We start working on graph algorithms via introducing networkx
and then a couple of simple algorithm for graph traversals.
Plan:
- Warm-up
- Go through
intro_to_networkx.ipynb
together - Complete
bfs_maze_template.py
- Go through
dfs_recursive()
indfs_maze.py
together - Complete
dfs_iterative()
indfs_maze_template.py
- Complete
topological_sort()
indfs_maze_template.py
- Go through
dfs_recursive_postorder()
indfs_maze.py
together (solution for point 6)
We study two classical graph problems: Minimum Spanning Tree and Shortest Path. We use Prim's algorithm to solve the former and Dijkstra's algorithm to solve the latter.
Plan:
- Warm-up
- Complete
mst_template.py
- Complete
sp_template.py
. We can do both the original version and the version with a priority queue.
We study fundamental data structures.
Plan:
- Warm-up
- Complete
valid_parentheses.py
(LIFO) - Complete
time_needed_to_buy_tickets.py
(FIFO) - Complete
linked_list.py
(linked list)
Homework:
time_needed_to_buy_tickets.py
: implement a proper solution for this problem.
We study simple computaional geomtery algorithms such as convex hull computing.
Plan:
- Warm-up
- Complete
slow_convex_hull.py
- Complete
qwer
Homework:
convex_bucket.py
: implement a convex hull algorithm constructing only the lower part of a convex hull which would "hold" all the points if they fell due to the gravity.
Cubic spline: http://getsomemath.ru/subtopic/computational_mathematics/approximation_theory/local_interpolation
LU: http://getsomemath.ru/subtopic/computational_mathematics/numerical_linear_algebra/gauss_methods
Homework:
lu.py
: implement the LU decomposition with and without pivoting and study how both implementations work for a gradually more ill-conditioned matrix.