Understand algorithms through Python implementations, step-by-step traces, correctness reasoning, and complexity analysis.
Created by python_scripts (Abhijith Warrier).
Learn how algorithms solve problems, why they work, and when to use them. The focus is on reasoning about the method—not simply memorizing an implementation.
The following topics describe the planned scope of the series. This roadmap is not a list of already published notebooks.
| Area | Concepts |
|---|---|
| Searching and array techniques | Binary search, two pointers, sliding windows, prefix sums, and Kadane’s algorithm. |
| Sorting and selection | Insertion sort, merge sort, quicksort, counting sort, quickselect, and heap-based selection. |
| Greedy methods and dynamic programming | Interval scheduling, coin change, knapsack, longest common subsequence, and edit distance. |
| Graphs and dependencies | BFS, DFS, topological sorting, Dijkstra, Bellman–Ford, Union–Find, and minimum spanning trees. |
| Strings, backtracking, and streams | KMP, Rabin–Karp, N-Queens, monotonic stacks, cycle detection, reservoir sampling, and running medians. |
Once this repository and its notebooks are available, clone it:
git clone https://github.com/abhijithwarrier/Python-Algorithm-Lab.git
cd Python-Algorithm-LabCreate and activate a virtual environment:
python -m venv .venvmacOS / Linux:
source .venv/bin/activateWindows PowerShell:
.venv\Scripts\Activate.ps1Install and launch JupyterLab:
python -m pip install jupyterlab
python -m jupyterlabUse python3 instead of python where required by your system. Open a notebook and run its cells from top to bottom. Any topic-specific packages and Python-version requirements will be stated in that notebook; install packages using its dedicated installation section.
Each implementation will state its preconditions and examine edge cases. Complexity discussions will distinguish worst-case, average-case, or amortized bounds where needed. Measured runtime is separate from theoretical complexity.
Run the example, change an input or assumption, and explain why the result changed. Keep the conceptual lesson connected to the code and its output.
Part of the python_scripts educational series: learning concepts by implementing and exploring them with Python.
Follow @python_scripts on Instagram for accompanying Reels and explanations.
Created by Abhijith Warrier