Implementations and explanations of classic data structures and algorithms, organized by topic, for study and quick reference.
Status: starting. The repository structure and conventions are defined below; implementations are added over time. Contributions are welcome from day one.
To be a place where each fundamental data structure and algorithm has:
- a short explanation of the idea and when to use it;
- a clean, commented implementation;
- its time and space complexity;
- small tests or examples that show it working.
Python is the first language; other languages are welcome side by side, in the same folder, as long as they follow the conventions below.
Data-Structures-and-Algorithms/
├── data-structures/
│ ├── arrays/
│ ├── linked-lists/ # singly, doubly, circular
│ ├── stacks-and-queues/
│ ├── hash-tables/
│ ├── trees/ # binary, BST, AVL, heaps, tries
│ └── graphs/ # representations, BFS, DFS
├── algorithms/
│ ├── sorting/ # bubble, insertion, merge, quick, heap, counting
│ ├── searching/ # linear, binary, interpolation
│ ├── recursion-and-backtracking/
│ ├── dynamic-programming/
│ ├── greedy/
│ └── graph-algorithms/ # Dijkstra, Bellman-Ford, Kruskal, Prim, topological sort
└── README.md
Each leaf folder contains a README.md with the explanation and complexity
table, one implementation file per language (for example linked_list.py), and
a test file (for example test_linked_list.py).
- Folder names in lowercase with hyphens; file names follow the language convention (snake_case for Python, PascalCase for C#).
- Every README has: problem, idea, step-by-step example, complexity (best, average, worst) and references.
- Code is readable before it is clever. Comments explain decisions, not syntax.
- Tests run with the standard toolchain of the language (for Python,
python -m pytestorpython -m unittest). State the version used. - No external dependencies unless the topic requires them.
-
Browse to the topic you want.
-
Read the
README.mdfor the concept and its complexity. -
Open the implementation and the tests, and run them:
git clone https://github.com/vitorparras/Data-Structures-and-Algorithms.git cd Data-Structures-and-Algorithms python -m pytest # once tests exist
New implementations, better explanations and corrections are welcome. Please
read CONTRIBUTING.md first. Open a
suggestion
before writing a large piece so we can agree on scope. The main branch is
protected and only receives changes through reviewed pull requests.
Found a problem in this repository's code or configuration? Follow SECURITY.md and report it privately.
This project follows the Contributor Covenant. By participating you agree to uphold it.
Licensed under the MIT License. Copyright © Vitor Hugo Parras.