We know

(i)Bubble Sort,

(ii)Selection Sort,

(iii)Insertion Sort,

(iv)Quick Sort

Here are my observation of

The

(i) Random data,

(ii) Reverse Ordered Data,

(iii) Almost Sorted Data

(iv) Highly Repetitive Data

I am Using

###

(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.

Matlab Source Code[GitHubLink]

_{}^{}_{}^{}

**(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.

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.m file for this question?

ReplyDeleteGitHub link

Delete