Sorting Algorithms

This repository contains python code for comparision based sorting techniques such as

  • Insertion Sort
  • Merge Sort
  • Heap Sort
  • In-Place Quick Sort
  • Modified Quick Sort

SortMain class is the main entry point and calls all of the above mentioned sorting algorithms in order to analyze their performance.

Following are the instructions to run python implementation of comparison-based sorting algorithms.

  • Unzip the source code package
  • Install Python3 and python package installer which is pip
  • Install MatPlotLib package for plotting graphs using pip
  • Open the code in IDE and make sure there are no errors seen in import statements
  • Go to the command prompt, navigate to the source code directory
  • Run the command: py SortMain.py
  • Enter the input size of your choice. The code is tested for below input sizes 1000,2000,3000,50000,10000,20000,30000,40000,50000,60000
  • Choose input sequence type. It can either be random integers, sorted sequence, or reverse sorted sequence
  • Code will generate an input sequence based on the end user’s preferences. All sorting algorithms will be executed thrice. The average time taken by each algorithm will be presented as output to the end user.
  • In case you want to verify the order of the sorted output, please remove the comment for the print statements which displays the sorted sequence generated by each algorithm.
  • In case you want to verify graphs plotted, run py plotGraph.py on the command prompt. Depending on which graph you want to generate, please comment or uncomment data accordingly.

GitHub

View Github