Skip to content

Harman-2/Search-Algorithm-Comparison-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ” Search Algorithm Comparison Tool

A modern Python desktop application for visualizing, comparing, and benchmarking classical search and sorting algorithms through an interactive dark-themed graphical interface built with Tkinter and Matplotlib.

Python Tkinter Matplotlib License


๐Ÿ“Œ Overview

The Search Algorithm Comparison Tool is an interactive desktop application that demonstrates how different search and sorting algorithms perform on the same dataset.

Instead of simply displaying the search result, the application benchmarks each algorithm by measuring:

  • โœ… Search result
  • โœ… Number of comparisons
  • โœ… Execution time
  • โœ… Runtime visualization
  • โœ… Performance comparison
  • โœ… Sorting visualization

The project was developed to help students understand algorithm efficiency while providing an attractive GUI for experimentation and learning.


โœจ Features

๐Ÿ”Ž Search Algorithms

Compare multiple searching techniques on the same dataset.

  • Linear Search
  • Binary Search
  • Binary Search Tree (BST)
  • Red-Black Tree (Self-Balancing BST)

The application displays:

  • Search result (Found / Not Found)
  • Index (where applicable)
  • Number of comparisons
  • Execution time
  • Fastest algorithm
  • Performance comparison chart

๐Ÿ“Š Sorting Algorithms

Visualize and compare sorting algorithms.

Supported algorithms include:

  • Bubble Sort
  • Insertion Sort
  • Merge Sort
  • Quick Sort

Features include:

  • Generate random datasets
  • Custom user input
  • Before/After visualization
  • Runtime measurement

๐Ÿ“ˆ Runtime Benchmarking

Benchmark all search algorithms across multiple dataset sizes.

The application automatically:

  • Generates random datasets
  • Executes every search algorithm
  • Records execution time
  • Displays runtime graphs
  • Supports Linear Scale
  • Supports Logarithmic Scale

๐ŸŽจ Modern User Interface

The application includes a clean dark-themed interface with:

  • Modern Tkinter layout
  • Responsive window
  • Organized tabs
  • Interactive charts
  • Results table
  • Winner banner
  • Real-time updates

๐Ÿš€ Algorithms Included

Search Algorithms

Algorithm Average Time Worst Time Space Complexity Requires Sorted Data
Linear Search O(n) O(n) O(1) โŒ No
Binary Search O(log n) O(log n) O(log n) โœ… Yes
Binary Search Tree O(log n) Average O(n) O(n) โŒ No
Red-Black Tree O(log n) O(log n) O(n) โŒ No

Sorting Algorithms

Algorithm Average Time Worst Time Space
Bubble Sort O(nยฒ) O(nยฒ) O(1)
Insertion Sort O(nยฒ) O(nยฒ) O(1)
Merge Sort O(n log n) O(n log n) O(n)
Quick Sort O(n log n) O(nยฒ) O(log n)

๐Ÿ› ๏ธ Tech Stack

Programming Language

  • Python 3.10+

GUI Framework

  • Tkinter
  • ttk Widgets

Visualization

  • Matplotlib

Data Structures

  • Arrays
  • Binary Search Tree
  • Red-Black Tree

Algorithms

  • Linear Search
  • Binary Search
  • Bubble Sort
  • Insertion Sort
  • Merge Sort
  • Quick Sort

๐Ÿ“‚ Project Structure

search-algorithm-comparison/
โ”‚
โ”œโ”€โ”€ app.py
โ”œโ”€โ”€ linear_search.py
โ”œโ”€โ”€ binary_search.py
โ”œโ”€โ”€ binary_search_tree.py
โ”œโ”€โ”€ red_black_tree.py
โ”œโ”€โ”€ sorting_algorithms.py
โ”‚
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ test_sorting.py
โ”‚
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ .gitignore

โš™๏ธ Installation

Clone Repository

git clone https://github.com/yourusername/search-algorithm-comparison.git

cd search-algorithm-comparison

Install Dependencies

pip install -r requirements.txt

Run Application

python app.py

๐Ÿ’ป Usage

Search Tab

  1. Generate a random array or enter custom values.
  2. Enter the target value.
  3. Select one search algorithm or compare all.
  4. Click Run Search.
  5. View:
  • Search result
  • Comparisons
  • Execution time
  • Winner
  • Comparison chart

Sorting Tab

  1. Generate random data.
  2. Select a sorting algorithm.
  3. Click Sort It!
  4. Compare:
  • Original array
  • Sorted array
  • Runtime

Runtime Charts

  1. Enter maximum input size.
  2. Select benchmark steps.
  3. Generate runtime charts.
  4. Compare algorithm scalability using:
  • Linear Scale
  • Logarithmic Scale

๐Ÿ“Š Performance Metrics

The application evaluates each algorithm using:

  • Execution Time
  • Number of Comparisons
  • Search Success
  • Search Index
  • Runtime Complexity
  • Scalability

๐Ÿž Improvements Over Previous Version

The latest version includes several improvements and bug fixes:

โœ” Fixed BST search returning incorrect results when value was not found.

โœ” Fixed Red-Black Tree integer printing issue.

โœ” Prevented duplicate labels after multiple searches.

โœ” Increased application window size from 750ร—250 to 1100ร—780.

โœ” Added comparison counters to every search algorithm.

โœ” Added runtime benchmarking charts.

โœ” Added sorting visualization.

โœ” Improved UI with modern dark theme.

โœ” Enhanced overall responsiveness and layout.


๐Ÿ“ท Application Modules

  • ๐Ÿ” Search Comparison
  • ๐Ÿ“Š Sorting Visualization
  • ๐Ÿ“ˆ Runtime Benchmarking
  • ๐Ÿ† Winner Detection
  • ๐Ÿ“‹ Result Table
  • ๐Ÿ“‰ Comparison Charts

๐ŸŽฏ Learning Objectives

This project demonstrates:

  • Searching Algorithms
  • Sorting Algorithms
  • Algorithm Analysis
  • Time Complexity
  • Space Complexity
  • Data Structures
  • Performance Benchmarking
  • GUI Development with Tkinter
  • Data Visualization using Matplotlib

๐Ÿ”ฎ Future Enhancements

  • Animated algorithm visualization
  • Additional sorting algorithms
  • Additional tree structures
  • Export benchmark results to CSV
  • Save performance reports
  • Adjustable visualization speed
  • Support for larger datasets
  • Memory usage analysis

๐Ÿ“„ License

This project was developed for educational and academic purposes.

Feel free to use, modify, and extend it for learning and research.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages