An enterprise-grade Java desktop application engineered to simulate, animate, and trace core Data Structures and Algorithms (DSA) in real-time. Built with a clean, object-oriented architecture and managed via Maven, this platform serves as an interactive educational tool to bridge the gap between theoretical algorithm logic and practical memory state execution.
Developed by: Syed Alvi (alvi164)
The primary goal of this suite is to provide a concurrent, visually responsive environment where users can manipulate data structures and observe algorithm execution step-by-step. It demonstrates advanced Java concepts including Multithreading, Polymorphism, and Hardware-Accelerated 2D Rendering.
The application is strictly modular, featuring 5 independent visualization engines:
- Algorithms: Selection, Bubble, Insertion, Merge, and Quick Sort.
- Rendering: Dynamically maps array values to visual gradient bars, highlighting active indices, pivots, and sorted boundaries in real-time.
- Interactive Canvas: Supports real-time node generation and edge mapping via mouse drag-and-drop.
- Algorithms: Breadth-First Search (BFS) and Depth-First Search (DFS).
- Execution Tracing: Features a live dry-run terminal that outputs the operational states of underlying FIFO Queues and LIFO Stacks during traversal.
- Binary Search Trees (BST): Animates node insertions, rebalancing logic, and pointer updates.
- Heaps: Visualizes the mathematical mapping of contiguous arrays into Min-Heap and Max-Heap 3D node structures.
- Graphics: Utilizes
Graphics2Dradial gradients and anti-aliasing to render pseudo-3D hierarchical relationships.
- Stack & Queue: Animates Push/Pop and Enqueue/Dequeue mechanics.
- Linked Lists: Dynamically generates simulated hexadecimal memory addresses (e.g.,
0x4F), visualizing the exact mechanics of Head, Tail, and Temporary traversal pointers.
- A unique interactive RAM grid that models how an Operating System calculates physical memory addresses.
- Visually contrasts the contiguous address mathematics of Arrays against the scattered pointer memory allocations of Binary Trees.
This project was built with a strong emphasis on maintainability and clean code principles:
- Polymorphic UI Lifecycle: Engineered around an abstract
BaseModulePanelclass. All individual algorithm modules inherit standardized UI layouts, slider controls, and canvas split-panes, adhering to the DRY (Don't Repeat Yourself) principle. - Concurrent Execution (Multithreading): Algorithm logic and UI rendering are strictly decoupled. Heavy iterative algorithms run on isolated background
Threadprocesses, safely communicating with the Java Swing Event Dispatch Thread (EDT) viaSwingUtilities.invokeLater()to prevent UI freezing. - State Management: Utilizes
volatilethreading flags and synchronized locks to allow users to pause, resume, and step through algorithms smoothly.
- Java Development Kit (JDK): Version 17 or higher.
- Apache Maven: Required for dependency resolution and build automation.
- Clone the repository:
git clone [https://github.com/alvi164/DSA-Algorithm-Visualizer.git](https://github.com/alvi164/DSA-Algorithm-Visualizer.git) cd DSA-Algorithm-Visualizer ## 🧪 Testing & Code Quality
To ensure absolute algorithmic correctness and prevent regression bugs, this platform features a completely decoupled, headless unit testing suite powered by JUnit 5.
The test suite isolates computation logic from the Java Swing Event Dispatch Thread (EDT), allowing assertions to verify states instantly without triggering GUI rendering delays.
- Algorithmic Correctness: Validates structural stability for Bubble, Selection, Insertion, Merge, and Quick Sort routines.
- Edge-Case Boundaries: Programmatically tests empty matrices, single-element structures, and uniform/identical element distributions.
To run the programmatic validation suite headlessly on your machine, execute the following standard Maven command in the root directory:
mvn test