This repository contains the implementation and analysis of various array sorting algorithms. The project includes tasks related to designing and analyzing a custom sorting algorithm, as well as an experimental study comparing multiple sorting algorithms.
CountingSort1.py
: Implementation of the counting sort algorithm for arrays with distinct elements.CountingSort2.py
: Modified counting sort algorithm to handle arrays with duplicate elements.sort_analysis.py
: Code for testing and comparing different sorting algorithms.
- Algorithm Design: Implement the
CountingSort
algorithm to sort an array of distinct integers. - Time Complexity Analysis: Analyze the time complexity using O-notation.
- Space Complexity Analysis: Determine the space complexity of the algorithm.
- Python Implementation: Implement the algorithm in Python (
CountingSort1.py
) and test it with an array of 20 distinct elements.
- Algorithm Modification: Modify the
CountingSort
algorithm to handle arrays with duplicate elements. - Time Complexity Analysis: Analyze the time complexity of the modified algorithm.
- Space Complexity Analysis: Determine the space complexity of the modified algorithm.
- Python Implementation: Implement the modified algorithm in Python (
CountingSort2.py
) and test it with an array containing duplicates.
- Main Menu: Create a system with a main menu for testing sorting algorithms.
- Option 1: Test an individual sorting algorithm.
- Option 2: Test multiple sorting algorithms.
- Option 3: Exit.
- Individual Algorithm Testing: Allow the user to select and test one of the following algorithms:
- Selection sort
- Insertion sort
- Merge sort
- Quick sort
- Heap sort
- Counting sort
- Multiple Algorithm Testing: Test all sorting algorithms using the same array and compare their performance.
- Comparison Table: Collect data on the number of comparisons and running time for each sorting algorithm over multiple runs and array sizes.
- Results Analysis: Analyze the results to compare the performance of different sorting algorithms.
- Clone the repository.
- Run the individual Python files to test specific parts of the project:
python CountingSort1.py
python CountingSort2.py
python sort_analysis.py
This project is licensed under the MIT License.
For any questions or feedback, please comment on repository.