Each operation is presented as a step-by-step, pausable, rewindable animation, with a live explanation of what is happening. AlgoLab was developed as an educational companion for a Data Structures and Algorithms course.
Linked List - Insert and delete operations, with HEAD and the algorithm's temporary PREVIOUS / CURRENT / NEW pointers shown as they move.
Graph - Build a custom directed/undirected, weighted/unweighted graph and run BFS, DFS, Dijkstra, or Bellman-Ford on it.
Sorting - Merge Sort visualized as an animated bar chart. Bubble, Selection, Insertion, Quick, and Heap Sort are also available on the same screen.
Sorting (race mode) - Race mode between Quick Sort and Merge Sort
Hash Table - Separate chaining collision resolution with a live load factor bar. Linear probing, quadratic probing, and double hashing are also supported.
Asymptotic Notation - Compare Big-O growth curves from O(1) to O(n^n) with an adjustable input size.
- Asymptotic Notation: Complexity graphs with adjustable inputs
- Linked Lists: Insert, delete, search
- Stacks: Push, pop, peek
- Queues: Enqueue, dequeue, peek
- Binary Search Trees: Insert, search, delete, min/max, traversals
- Heaps: Min/Max heaps, insert, peek, extract, heapify
- Graphs: Directed/undirected, weighted/unweighted, BFS, DFS, Dijkstra, Bellman-Ford
- Sorting: Bubble Sort, Insertion Sort, Merge Sort, Quick Sort, Heap Sort
- Hash Tables & Sets: Chaining, probing, double hashing, Set/Map modes, configurable hash functions, collision counting
-
Step-by-step, pausable, and rewindable simulations
-
Adjustable animation speed
-
Live explanations of operations
-
Color-coded operations and legends
-
Configurable data structure attributes
-
Randomize button for every topic
-
Per-topic Big-O reference table through the Info button on every topic screen
-
Fullscreen, auto-scaled to the machine's native resolution
-
Screenshot capture (
F12), saved toassets/screenshots/ -
Keyboard shortcuts:
PPause/Resume<-/->Step backward/forwardEnterRun the primary actionF12Take a screenshotEscQuit
- Python 3.10+
- Pygame
git clone https://github.com/AmirmasoudCS/AlgoLab.git
cd AlgoLabpython -m venv .venvWindows:
.venv\Scripts\activateLinux / macOS:
source .venv/bin/activatepip install -r requirements.txtRun from the source:
python -m algolab.mainBuild a standalone application:
AlgoLab can also be packaged as a standalone executable using PyInstaller.
pyinstaller AlgoLab.specThe packaged application will be available in the dist/ directory.
Each topic follows the same structure:
model.py # Data structure and state
operations.py # Operations performed on the structure
simulation.py # Step-by-step simulation
Simulations operate on a copy of the model's state and record each intermediate state as an immutable snapshot. The real model is only updated when the simulation completes.
This allows operations to be paused, replayed, rewound, and committed without modifying the actual data structure during the animation.
Randomize actions bypass the simulation layer and use the data structure's normal operations to produce an immediate state.
π
βββ π assets
β βββ π screenshots
β β βββ πΌοΈ asymptotic.png
β β βββ πΌοΈ bst.png
β β βββ πΌοΈ graph.png
β β βββ πΌοΈ hash_chaing.png
β β βββ πΌοΈ heap.png
β β βββ πΌοΈ linked_list.png
β β βββ πΌοΈ main_menu.png
β β βββ πΌοΈ merge_sort.png
β β βββ πΌοΈ queue.png
β β βββ πΌοΈ stack.png
β βββ π icon.ico
β βββ πΌοΈ icon.png
βββ π config
β βββ βοΈ config.toml
βββ π log
βββ π src
β βββ π algolab
β βββ π core
β β βββ π __init__.py
β β βββ π application.py
β β βββ π configuration.py
β βββ π simulation
β β βββ π __init__.py
β β βββ π events.py
β β βββ π history.py
β β βββ π simulator.py
β β βββ π state.py
β βββ π topics
β β βββ π asymptotic
β β β βββ π __init__.py
β β β βββ π complexity.py
β β β βββ π model.py
β β β βββ π visualizer.py
β β βββ π bst
β β β βββ π __init__.py
β β β βββ π model.py
β β β βββ π operations.py
β β β βββ π simulation.py
β β βββ π graph
β β β βββ π __init__.py
β β β βββ π model.py
β β β βββ π simulation.py
β β βββ π hash_table
β β β βββ π __init__.py
β β β βββ π model.py
β β β βββ π operations.py
β β β βββ π simulation.py
β β βββ π heap
β β β βββ π __init__.py
β β β βββ π model.py
β β β βββ π operations.py
β β β βββ π simulation.py
β β βββ π linked_list
β β β βββ π __init__.py
β β β βββ π model.py
β β β βββ π operations.py
β β β βββ π simulation.py
β β βββ π queue
β β β βββ π __init__.py
β β β βββ π model.py
β β β βββ π operations.py
β β β βββ π simulation.py
β β βββ π sorting
β β β βββ π __init__.py
β β β βββ π model.py
β β β βββ π operations.py
β β β βββ π simulation.py
β β βββ π stack
β β β βββ π __init__.py
β β β βββ π model.py
β β β βββ π operations.py
β β β βββ π simulation.py
β β βββ π __init__.py
β βββ π ui
β β βββ π components
β β β βββ π __init__.py
β β β βββ π button.py
β β β βββ π checkbox.py
β β β βββ π info_panel.py
β β β βββ π numeric_input.py
β β β βββ π radio_button.py
β β β βββ π surface.py
β β βββ π screens
β β β βββ π __init__.py
β β β βββ π asymptotic.py
β β β βββ π bst.py
β β β βββ π graph.py
β β β βββ π hash_table.py
β β β βββ π heap.py
β β β βββ π linked_list.py
β β β βββ π main_menu.py
β β β βββ π queue.py
β β β βββ π screen.py
β β β βββ π screen_manager.py
β β β βββ π sorting.py
β β β βββ π stack.py
β β βββ π __init__.py
β β βββ π theme.py
β βββ π visualization
β β βββ π graph
β β β βββ π __init__.py
β β β βββ π bounds.py
β β β βββ π coordinate_system.py
β β β βββ π curve.py
β β β βββ π layout.py
β β β βββ π renderer.py
β β β βββ π scaling.py
β β βββ π __init__.py
β βββ π __init__.py
β βββ π main.py
βββ π tests
β βββ π core
β β βββ π __init__.py
β β βββ π test_configuration.py
β βββ π simulation
β β βββ π __init__.py
β β βββ π test_events.py
β β βββ π test_history.py
β β βββ π test_simulator.py
β β βββ π test_state.py
β βββ π topics
β β βββ π asymptotic
β β β βββ π __init__.py
β β β βββ π test_complexity.py
β β β βββ π test_model.py
β β β βββ π test_visualizer.py
β β βββ π bst
β β β βββ π test_bst_model.py
β β β βββ π test_bst_operations.py
β β β βββ π test_bst_simulation.py
β β βββ π heap
β β β βββ π test_heap_model.py
β β β βββ π test_heap_operations.py
β β β βββ π test_heap_simulation.py
β β βββ π linked_list
β β β βββ π test_linked_list_model.py
β β β βββ π test_operations.py
β β β βββ π test_simulation.py
β β βββ π queue
β β β βββ π test_queue_model.py
β β β βββ π test_queue_operations.py
β β β βββ π test_queue_simulation.py
β β βββ π stack
β β β βββ π test_stack_model.py
β β β βββ π test_stack_operations.py
β β β βββ π test_stack_simulation.py
β β βββ π __init__.py
β βββ π ui
β β βββ π compontets
β β β βββ π checkbox.py
β β β βββ π radio_button.py
β β βββ π screens
β β β βββ π __init__.py
β β β βββ π test_asymptotic.py
β β β βββ π test_main_menu.py
β β β βββ π test_screen.py
β β β βββ π test_screen_manager.py
β β βββ π __init__.py
β βββ π visualization
β β βββ π graph
β β β βββ π __init__.py
β β β βββ π test_bounds.py
β β β βββ π test_coordinate_system.py
β β β βββ π test_curve.py
β β β βββ π test_layout.py
β β β βββ π test_scaling.py
β β βββ π __init__.py
β βββ π __init__.py
βββ π AlgoLab.spec
βββ βοΈ LICENSE
βββ βοΈ pyproject.toml
βββ π README.md
βββ π requirements.txt
βββ π smoke_test.py
Generated using Tree Printer
AlgoLab uses pytest for automated testing.
pytestTests cover the core logic, simulation system, data structure operations, UI components, and visualization utilities.
- BST Randomization can produce highly skewed trees depending on insertion order.
- Heap Type Switching rebuilds the heap when switching between Min and Max modes.
- Hash Tables do not automatically resize when an open-addressing table becomes full.
- Queue's
dequeueis O(n) in this implementation (list.pop(0)), not the textbook O(1). A deque- or linked-list-backed queue would achieve O(1).
This project is licensed under the MIT License.





