Skip to content

An interactive tool to visualize and understand data structures like stacks, queues, trees, and graphs in real time.

License

Notifications You must be signed in to change notification settings

lakshitavyas02/DS_Visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  Interactive Data Structure Visualizer

An educational tool built entirely in Python using Streamlit that enables users to understand and experiment with core data structures through real-time visual feedback.

image

๐ŸŒŸ Features

๐Ÿ“š Supported Data Structures

  • ๐Ÿฅž Stack (LIFO) - Last In, First Out operations
  • ๐Ÿšถโ€โ™‚๏ธ Queue (FIFO) - First In, First Out operations
  • ๐Ÿ”— Linked List - Singly and Doubly linked lists
  • ๐ŸŒณ Binary Tree - Binary Search Tree with traversals
  • ๐Ÿ—‚๏ธ Hash Table - Key-Value storage with collision handling
  • ๐Ÿ”๏ธ Heap - Min/Max Heap with priority queue operations
  • ๐Ÿ•ธ๏ธ Graph - Directed/Undirected graphs with traversals

๐ŸŽฎ Interactive Controls

  • Perform operations like push, pop, enqueue, dequeue, insert, delete, traverse
  • Input values dynamically and see changes instantly
  • Real-time visual updates with every operation

๐Ÿ” Step-by-Step Execution

  • Simple animations using Python's time.sleep()
  • Visual updates rendered on every operation
  • Clear understanding of data structure behavior

๐Ÿง  Educational Aid

  • Displays matching pseudocode alongside each operation
  • Helps learners grasp both logic and implementation flow
  • Operation history tracking for learning progress

๐Ÿ–ฅ๏ธ No Frontend Code Needed

  • Entirely built in Python with Streamlit widgets
  • Buttons, sliders, and expandable code sections
  • Clean, intuitive user interface

๐Ÿ› ๏ธ Tech Stack

  • Python 3.8+
  • Streamlit - Web app framework
  • Matplotlib - Visualization and plotting
  • Custom Python Classes - Data structure implementations

๐Ÿš€ Installation & Setup

Prerequisites

  • Python 3.8 or higher
  • pip package manager

Installation Steps

  1. Clone or download the project

    git clone <repository-url>
    cd VISUALIZER
  2. Install dependencies

    pip install -r requirements.txt
  3. Run the application

    streamlit run main.py
  4. Open in browser

    • The app will automatically open in your default browser
    • If not, navigate to http://localhost:8501

๐Ÿ“– Usage Guide

Getting Started

  1. Launch the application using streamlit run main.py
  2. Choose a data structure from the sidebar navigation
  3. Perform operations using the interactive controls
  4. Watch the visualization update in real-time
  5. Study the pseudocode to understand algorithms
  6. Track your progress through operation history

Data Structure Operations

๐Ÿฅž Stack Operations

  • Push: Add element to top of stack
  • Pop: Remove element from top of stack
  • Peek: View top element without removing
  • Clear: Empty the entire stack

๐Ÿšถโ€โ™‚๏ธ Queue Operations

  • Enqueue: Add element to rear of queue
  • Dequeue: Remove element from front of queue
  • Front: View front element without removing
  • Rear: View rear element without removing
  • Clear: Empty the entire queue

๐Ÿ”— Linked List Operations

  • Insert at Beginning: Add node at the start
  • Insert at End: Add node at the end
  • Insert at Position: Add node at specific position
  • Delete: Remove node with specific value
  • Search: Find position of a value
  • Clear: Remove all nodes

๐ŸŒณ Binary Tree Operations

  • Insert: Add node maintaining BST property
  • Delete: Remove node from tree
  • Search: Find if value exists in tree
  • Traversals: Inorder, Preorder, Postorder
  • Clear: Remove all nodes

๐Ÿ—‚๏ธ Hash Table Operations

  • Insert/Update: Add or update key-value pairs
  • Get: Retrieve value by key
  • Delete: Remove key-value pair
  • Contains: Check if key exists
  • Clear: Remove all entries

๐Ÿ”๏ธ Heap Operations

  • Insert: Add element maintaining heap property
  • Extract: Remove root element (min/max)
  • Peek: View root without removing
  • Delete: Remove specific value
  • Build Heap: Create heap from array
  • Heap Sort: Sort elements using heap

๐Ÿ•ธ๏ธ Graph Operations

  • Add Vertex: Add new node to graph
  • Add Edge: Connect two vertices
  • Remove Vertex/Edge: Delete nodes or connections
  • BFS/DFS: Breadth-first and depth-first traversals
  • Path Finding: Check if path exists between vertices
  • Clear: Remove entire graph

๐Ÿ“ Project Structure

VISUALIZER/
โ”œโ”€โ”€ main.py                          # Main Streamlit application
โ”œโ”€โ”€ requirements.txt                 # Python dependencies
โ”œโ”€โ”€ README.md                       # Project documentation
โ”œโ”€โ”€ data_structures/                # Data structure implementations
โ”‚   โ”œโ”€โ”€ stack.py                    # Stack class
โ”‚   โ”œโ”€โ”€ queue.py                    # Queue class
โ”‚   โ”œโ”€โ”€ linked_list.py              # Linked List classes
โ”‚   โ”œโ”€โ”€ binary_tree.py              # Binary Tree class
โ”‚   โ”œโ”€โ”€ hash_table.py               # Hash Table class
โ”‚   โ”œโ”€โ”€ heap.py                     # Heap class
โ”‚   โ””โ”€โ”€ graph.py                    # Graph class
โ”œโ”€โ”€ visualizers/                    # Visualization components
โ”‚   โ”œโ”€โ”€ stack_visualizer.py         # Stack visualization
โ”‚   โ”œโ”€โ”€ queue_visualizer.py         # Queue visualization
โ”‚   โ”œโ”€โ”€ linked_list_visualizer.py   # Linked List visualization
โ”‚   โ”œโ”€โ”€ binary_tree_visualizer.py   # Binary Tree visualization
โ”‚   โ”œโ”€โ”€ hash_table_visualizer.py    # Hash Table visualization
โ”‚   โ”œโ”€โ”€ heap_visualizer.py          # Heap visualization
โ”‚   โ””โ”€โ”€ graph_visualizer.py         # Graph visualization
โ””โ”€โ”€ utils/                          # Utility modules
    โ””โ”€โ”€ pseudocode.py               # Algorithm pseudocode definitions

๐ŸŽฏ Use Cases

๐Ÿ‘จโ€๐ŸŽ“ For Students

  • Learn fundamental data structures visually
  • Understand algorithm implementations
  • Practice for computer science courses
  • Prepare for coding interviews

๐Ÿ‘ฉโ€๐Ÿซ For Educators

  • Teaching aid for data structure concepts
  • Interactive classroom demonstrations
  • Visual explanation of abstract concepts
  • Engaging learning experience

๐Ÿ’ผ For Interview Preparation

  • Practice common data structure operations
  • Understand time and space complexity
  • Review algorithm implementations
  • Build confidence with visual feedback

๐Ÿ”ง Customization

Adding New Data Structures

  1. Create implementation in data_structures/
  2. Add pseudocode to utils/pseudocode.py
  3. Create visualizer in visualizers/
  4. Update main navigation in main.py

Modifying Visualizations

  • Edit matplotlib plotting code in visualizer files
  • Adjust colors, sizes, and layouts
  • Add new animation effects
  • Customize user interface elements

๐Ÿค Contributing

Contributions are welcome! Please feel free to:

  • Report bugs and issues
  • Suggest new features
  • Submit pull requests
  • Improve documentation

๐Ÿ“„ License

This project is open source and available under the MIT License.

๐Ÿ™ Acknowledgments

  • Built with Streamlit for the amazing web app framework
  • Matplotlib for powerful visualization capabilities
  • Python community for excellent libraries and tools

Start exploring data structures today! ๐Ÿš€

Select a data structure from the sidebar and begin your interactive learning journey!

About

An interactive tool to visualize and understand data structures like stacks, queues, trees, and graphs in real time.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages