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.
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.
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
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
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
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
| 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 |
| 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) |
- Python 3.10+
- Tkinter
- ttk Widgets
- Matplotlib
- Arrays
- Binary Search Tree
- Red-Black Tree
- Linear Search
- Binary Search
- Bubble Sort
- Insertion Sort
- Merge Sort
- Quick Sort
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
git clone https://github.com/yourusername/search-algorithm-comparison.git
cd search-algorithm-comparisonpip install -r requirements.txtpython app.py- Generate a random array or enter custom values.
- Enter the target value.
- Select one search algorithm or compare all.
- Click Run Search.
- View:
- Search result
- Comparisons
- Execution time
- Winner
- Comparison chart
- Generate random data.
- Select a sorting algorithm.
- Click Sort It!
- Compare:
- Original array
- Sorted array
- Runtime
- Enter maximum input size.
- Select benchmark steps.
- Generate runtime charts.
- Compare algorithm scalability using:
- Linear Scale
- Logarithmic Scale
The application evaluates each algorithm using:
- Execution Time
- Number of Comparisons
- Search Success
- Search Index
- Runtime Complexity
- Scalability
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.
- ๐ Search Comparison
- ๐ Sorting Visualization
- ๐ Runtime Benchmarking
- ๐ Winner Detection
- ๐ Result Table
- ๐ Comparison Charts
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
- 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
This project was developed for educational and academic purposes.
Feel free to use, modify, and extend it for learning and research.