THE SORTING AESTHETICS.

Maqbool Ahmed
3 min readMar 31, 2022

Hello Everyone! Today we will be performing multiple sorting techniques on different sets of random numbers. Besides this, we also observe the compilation time of each technique on multiple numeric sets of data.

For which, I have created a program for generating random numbers on a .txt file.

Source code:

(Note: Source Code link will be shared soon.)

Output:

Similarly, I have created seven different sets of .txt files using this program i.e 50nums, 100nums, 200nums, 300nums, 400nums, 500nums, 1000nums.

Applying Sorting Techniques:

For sorting these numeric data, I have applied following sorting Techniques:

  1. Insertion Sort
  2. Merge Sort
  3. Quick Sort using Middle Pivot Method
  4. Quick Sort using Random Pivot Method
  5. Quick Sort using Median Pivot Method
  6. Quick Sort using Updated_Median/Median of Three Pivot Method

Graphical Representation :

Below are the graphical representations of different sorting techniques and there time consumption.

While sorting 50 elements, we can see that Insertion Sort is fastest.
While sorting 100 elements, we can see that Insertion Sort is fastest.
While sorting 200 elements, we can see that Middle Pivot Quick Sort is fastest.
While sorting 300 elements, we can see that Insertion Sort is fastest.
While sorting 400 elements, we can see that Insertion Sort is fastest.
While sorting 500 elements, we can see that Updated Median Pivot Quick Sort is fastest.
While sorting 1000 elements, we can see that Random Pivot Quick Sort is fastest.

CONCLUSION:

While observing the graphs above, we can see that the average: slowest sorting technique is Merge Sort, Insertion Sort is the fastest but on gradual increase in numeric data, we can see that Updated Median Quick Sort is getting faster.

Some Coding Snippets:

(Note: Email for the Source Code: maqboolshaikh321@gmail.com.)

I hope you have learnt things from this Article, for further Queries comment down below, I try my Best to entertain all of your Queries as soon as possible!

Don’t forget to like, share and Follow!

THANKS FOR YOUR TIME!

CHEERS!

AND HAVE A NICE LIFE!

--

--