This project is a tool for visualising common sorting, searching, and graph traversal algorithms. Built with
matplotlib, it provides animated demonstrations of how each algorithm works. This is ideal for learning data
structures and algorithms interactively.
-
Sorting Visualisations:
- Bubble Sort
- Selection Sort
- Insertion Sort
- Quick Sort
- Merge Sort
-
Searching Visualisations:
- Linear Search
- Binary Search
-
Tree Traversals:
- Depth-First Search (DFS)
- Breadth-First Search (BFS)
-
Adjustable speed slider
-
Adjustable array size/depth
Install dependencies into a virtual environment (recommended):
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txtRun the script from the command line:
python main.pySelect the desired algorithm, and adjust sliders:
I have provided GIFs for some searching, sorting and traversal algorithms in action below, using my visualisation tool:
Depth First Search Binary Tree: Green means it has been visited, red is the current node,
blue are the unvisited nodes.
Binary Search: Grey elements have been eliminated as possibilities, purple are the boundaries,
red is the middle index, blue are unvisited nodes.
Bubble Sort: Red elements are the values being compared, orange indicates a swap between these elements,
green indicates an element in it's sorted position.
