0% found this document useful (0 votes)
4 views

Data Structure

The document outlines a project using Python 3 to analyze and visualize the performance of various sorting algorithms, including insertion sort, merge sort, and quick sort. It details the code structure, execution flow, and features of a GUI application that allows users to compare algorithms, save results, and visualize data. The findings indicate that Quick Sort and Merge Sort generally outperform others, while Bubble Sort is less efficient, with suggestions for future enhancements to the study.

Uploaded by

az707675
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Data Structure

The document outlines a project using Python 3 to analyze and visualize the performance of various sorting algorithms, including insertion sort, merge sort, and quick sort. It details the code structure, execution flow, and features of a GUI application that allows users to compare algorithms, save results, and visualize data. The findings indicate that Quick Sort and Merge Sort generally outperform others, while Bubble Sort is less efficient, with suggestions for future enhancements to the study.

Uploaded by

az707675
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 24

Data Structure

CSE331
DR. HESHAM FARAG
Introduction

 First, we have used python 3 as a programming language. Our


main goal is to plot the graph of steps of many important sorting
algorithms like insertion sort, merge sort, heap sort, counting
sort, quick Sort, bubble and radix Sort. Moreover, we will show
the notation of each algorithm, compare between steps of these
algorithms to know which is quicker and efficient. By making
such comparison, the uses and advantages of each algorithm will
be clearly displayed.
Code Illustration
Code Overview
1.Modules and Purpose:
•plot_graphs.py: Handles graphing and visual representation
of sorting algorithm performance (steps, execution time,
complexity).
•constant.py: Defines constants like input sizes, sorting
scenarios, and algorithm complexities.
•generator.py: Generates test cases (random, sorted,
reversed arrays) and runs sorting tests.
•gui_app.py: Provides a GUI for interactive sorting algorithm
execution and visualization.
•sorting_algorithms.py: Implements sorting algorithms and
calculates steps for each sorting operation.
2.Execution Flow:
•The GUI or generator.main() initiates the program.
•Arrays are generated (generator.py).
•Sorting algorithms process the arrays, recording steps and execution
times (sorting_algorithms.py).
•Results are stored in a CSV file and visualized via graphs
(plot_graphs.py).
3.Key Connections:
•generator.py depends on:
•constant.py for configurations.
•sorting_algorithms.py for algorithm logic.
•plot_graphs.py for visualization.
•gui_app.py provides a user interface for these features.
•plot_graphs.py uses matplotlib and seaborn for graph generation.
Main Application GUI
Compare page
in Compare page is called in each algorithm
to bind the needed x and y axes then this
function. And in GUI each button is set
command to use for each algorithm to get x
and y but wait until another one selected
and give them to compare_two_algorithms
( ).
Output:
Save Test Cases as CSV

The sorting algorithms tester GUI's "Save


Test Cases as CSV" button enables users
to export test results into a CSV file,
capturing algorithm names, steps, and
execution times, enabling easy
performance analysis, sharing, and
statistical evaluation.
Save Graph as PNG

The "Save Graph as PNG" button in the sorting


algorithms tester GUI provides a straightforward
way to export and save graphical
representations of sorting test results as PNG
images. This feature enables users to visually
capture and preserve the performance
comparison of different sorting algorithms, such
as steps taken and execution times, in a clear
and accessible format. By saving the graphs as
PNG files, users can easily include these
visuals in reports, presentations, or share them
for collaborative analysis, enhancing the
interpretability and presentation of the test data.
Algorithm Efficiency

Algorithm Efficiency in sorting algorithms is the efficiency of an


algorithm in terms of time and space utilization. Efficient
algorithms optimize these aspects to reduce computational
overhead and improve performance. Quick Sort and Merge
Sort offer better time efficiencies for large datasets, while
Bubble Sort may perform less efficiently due to costly methods.
Steps notation Comparison

"Steps Notation Comparison" evaluates the


number of operations a sorting algorithm takes to
sort an array, often in Big O notation. This helps
developers choose the most appropriate sorting
algorithm based on the specific needs of the
application, balancing performance and
computational resource usage.
Asymptotic Notation

Asymptotic Notation is a mathematical tool used


in computer science to describe algorithm
behavior as input size approaches infinity. It
provides a high-level understanding of an
algorithm's efficiency in terms of time and space
complexity. Common forms include Big O,
Theta, and Omega. Understanding asymptotic
notation is crucial for algorithm analysis and
informed software development decisions.
Comparing Algorithms Examples
This section compares the efficiency
and execution time of the sorting
algorithms. Through various tests, we
analyze how each algorithm performs
under different scenarios and with
different data sizes. Detailed graphs
and statistical analysis provide insight
into which algorithms are more
efficient.
Insertion sort
Merge sort
Heap Sort
Counting sort
Quick sort
Bubble sort
Radix sort
Selection sort
Example for each graph type
Conclusion
 The project demonstrates the
varied performance of
different sorting algorithms.
Algorithms like Quick Sort
and Merge Sort showed the
best performance in most
scenarios, while algorithms
like Bubble Sort were less
efficient. Future work could
expand the dataset sizes and
include more complex
algorithms.

You might also like