(There may be bugs :) Be careful!!!)
This project is a visualization tool for common data structures and algorithms, built using C++ and the Raylib library. It allows users to interactively observe how data structures change step-by-step during fundamental operations like insertion, deletion, and search.
- Step-by-Step Visualization: Detailed tracing of algorithm execution on data structures.
- User Interaction: Allows users to input data, select operations (insert, delete, search, randomize, load from file).
- Animation Control: Play, pause, step forward/backward, jump to start/end, and adjust animation speed.
- Pseudocode Display: Shows corresponding pseudocode snippets for the current step for easy reference (not compeletely).
The project currently supports visualization for the following data structures:
- AVL Tree
- Hash Table (Linear Probing)
- 2-3-4 Tree
- Max Heap
- Trie (Prefix Tree)
- Graph: Includes algorithms like finding connected components and Minimum Spanning Tree (MST - Kruskal).
- Programming Language: C++
- Graphics and Multimedia Library: Raylib
- File Dialog Library: Portable File Dialogs
- Build System: GCC/G++ (via Makefile)
data-structures-visualization/
├── assets/
│ ├── demo/
│ ├── fonts/
│ └── images/
├── build/
│ ├── bin/
│ └── obj/
├── external/
│ ├── portable-file-dialogs.h
│ ├── raylib.h
│ ├── raymath.h
│ └── rlgl.h
├── include/
│ ├── core/
│ │ ├── Application.h
│ │ ├── General.h
│ │ └── Menu.h
│ ├── datastructures/
│ │ ├── AVL.h
│ │ ├── Graph.h
│ │ ├── HashTable.h
│ │ ├── MaxHeap.h
│ │ ├── Tree234.h
│ │ └── Trie.h
│ ├── gui/
│ │ ├── Button.h
│ │ ├── CircleButton.h
│ │ ├── ImageButton.h
│ │ ├── InputStr.h
│ │ ├── ProgressBar.h
│ │ ├── TitleButton.h
│ │ └── Util.h
│ └── visualization/
│ ├── AVLTreeVisualize.h
│ ├── GraphVisualize.h
│ ├── HashTableVisualize.h
│ ├── MaxHeapVisualize.h
│ ├── Tree234Visualize.h
│ └── TrieVisualize.h
├── lib/
│ ├── Linux/
│ └── libraylib.a
│ ├── MacOS/
│ └── libraylib.dylib
│ ├── Web/ # For later updating
│ └── libraylib.a
│ └── Window/
│ └── libraylib.a
├── sampleData/ # Sample data for test
├── src/
│ ├── core/
│ │ ├── Application.h
│ │ ├── General.h
│ │ └── Menu.h
│ ├── datastructures/
│ │ ├── AVL.h
│ │ ├── Graph.h
│ │ ├── HashTable.h
│ │ ├── MaxHeap.h
│ │ ├── Tree234.h
│ │ └── Trie.h
│ ├── gui/
│ │ ├── Button.h
│ │ ├── CircleButton.h
│ │ ├── ImageButton.h
│ │ ├── InputStr.h
│ │ ├── ProgressBar.h
│ │ ├── TitleButton.h
│ │ └── Util.h
│ ├── visualization/
│ | ├── AVLTreeVisualize.h
│ | ├── GraphVisualize.h
│ | ├── HashTableVisualize.h
│ | ├── MaxHeapVisualize.h
│ | ├── Tree234Visualize.h
│ | └── TrieVisualize.h
│ └── main.cpp
├── Makefile
└── README.md
- C++ Compiler: GCC/G++ (recommended) or Clang.
- Make: Build automation tool.
- (Linux) Necessary libraries for Raylib (typically
libgl1-mesa-dev,libglu1-mesa-dev,libx11-dev,libxrandr-dev,libxi-dev,libxcursor-dev,libxinerama-dev,libasound2-dev).# Example on Ubuntu/Debian sudo apt update sudo apt install build-essential libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxrandr-dev libxi-dev libxcursor-dev libxinerama-dev libasound2-dev
-
Clone the repository (if applicable):
git clone https://github.com/NgTrongDoanh/data-structures-visualization.git cd data-structures-visualization -
Build the project: Use the provided Makefile. Open a terminal in the project's root directory and run:
make
This will compile the source code and create an executable in the
build/bin/directory. The default executable name is usuallyds_visualizer. -
Run the program:
make run
(Or
./build/bin/ds_visualizer)
Contributions are welcome! If you'd like to contribute to this project, please:
- Fork the repository.
- Create a new branch (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'Add some AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a Pull Request.
Any contributions, big or small, are greatly appreciated!
- TrDoanh - [VNUHCM - University of Science]