A program that analyses the various sorting algorithms, compares their runtime and generates plots based on their runtimes for various kinds of inputs.
To run the test follow the following instructions:
- Make sure you have java version 11 or above
- Make sure you have python 3 installed
- Install matplotlib using pip install matplotlib
- Run command - py generator.py
The final plots will be available in the 'Plots' folder.
NOTE: It can take upto 5 minutes for all the plots to be generated.
Example of generated plot of insertion sort:
The program works as follows:
- When the user runs generator.py, the script first runs Analyser.java for each of the different sorting algorithms.
- Everytime Analyser.java is run for a sorting algorithm, it runs the sorting algorithms on auto-generated integer arrays and records the runtime.
- The runtimes are recorded in the output.txt file.
- The output.txt file is read by plotter.py which takes the runtimes and plots them on a graph using the matplotlib library.