Skip to content

harsij01/algorithm_visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

111 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Algorithm Visualizer

A web-based algorithm visualizer built with Flask, Python, and JavaScript.


Project Description

This application allows users to:

  • Visualize sorting algorithms step-by-step
  • Compare algorithm performance
  • Analyze time complexity
  • Benchmark runtime and operation counts

This project was built to:

  • Understand how sorting algorithms work internally
  • Visualize algorithm behavior in real-time
  • Compare theoretical complexity vs actual runtime
  • Strengthen full-stack development skills

The application supports both:

  • Visual Mode – animated step-by-step sorting
  • Benchmark Mode – runtime and operation comparison

See it in Action

Watch the video


Supported Algorithms

  • Bubble Sort
  • Selection Sort
  • Insertion Sort
  • Merge Sort

Each algorithm includes:

  • Operation counting
  • Time complexity analysis
  • Step tracking for animation

Features

Visualization

  • Dynamic bar width (responsive to array size)
  • Color-coded highlights:
    • 🔴 Comparison
    • 🟠 Swap
    • 🟢 Insert / Overwrite
    • 🟡 Minimum index change
    • 🟣 Shift
  • Adjustable animation speed
  • Supports custom and randomly generated arrays

Benchmark Mode

  • Compare two algorithms side-by-side
  • Runtime measurement (milliseconds)
  • Operation count comparison
  • Displays theoretical time complexities:
    • Best case
    • Average case
    • Worst case

Backend Validation

  • Input validation for numeric arrays
  • Maximum array size protection
  • Mode and algorithm validation
  • Graceful error handling

Tech Stack

  • Backend
    • Python
    • Flask
  • Frontend
    • HTML5
    • CSS3
    • Bootstrap 5
    • JavaScript (Vanilla)
    • Chart.js

Installation

  1. Clone this repository:
git clone https://github.com/harsij01/algorithm_visualizer
cd algorithm_visualizer
  1. Create a Virtual Environment (Recommended)

Windows:

python -m venv venv
venv\Scripts\activate

Mac/Linux:

python3 -m venv venv
source venv/bin/activate
  1. Install Dependencies
pip install -r requirements.txt
  1. Run the Application
python app.py
  1. Open in Browser
http://127.0.0.1:5000

📸 Screenshots

Visual Mode

Visual Mode

Benchmark Mode

Benchmark Mode

About

A web-based tool to visualize how algorithms work in real time.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors