Monday 13 April 2015

ANALYSIS OF SORTING ALGORITHMS

We know
(i)Bubble Sort,
(ii)Selection Sort,
(iii)Insertion Sort,
(iv)Quick Sort
Here are my observation of
The asymptotic behavior of each of the sorting algorithms for each of the data types
(i) Random data,
(ii) Reverse Ordered Data,
(iii) Almost Sorted Data
(iv) Highly Repetitive Data

I am Using Matlab for Simulation

Matlab Source Code[GitHub Link] 


(i)Comparision Table for Random data:

Graph for Random data
(here Selection and bubble sort curve are overlapping as they have same no. of comparision)
Observation:
After performing the analysis starting from small dataset containg 10 elements to large dataset containing 100 elements,
We see that,Quick sort is better when the no of elements exceed 23(approx).
Insertion sort is good for less then 23 elements.
Bubble and selection sort has identical no of comparisions not used for large dataset.
(ii)Comparision Table for Almost Sorted data:
Graph for Almost Sorted data

(here Selection and bubble sort curve are overlapping as they have same no. of comparision)
Observation: 
After performing the analysis starting from small dataset containg 10 elements to large dataset containing 100 elements,
We see that,Insertion sort is better when the elements are in almost sorted order.
Quick ,Bubble and selection sort has almost identical no of comparisions  in case of this data set.



5 comments:

  1. Good post.Very helpful tutorial.I have interest in programming language but most of the time i did not get the tutorials or example.But this blog giving the correct information.I am not an expert in wring so i took the guidelines from the custom essay service.

    ReplyDelete
  2. .m file for this question?

    ReplyDelete
  3. The team is engaged and direct best branding firms, asking smart questions that have improved the overall functionality of the app

    ReplyDelete

THANKS FOR UR GREAT COMMENT

Blogger Widgets