all types of Sorting
-
Upload
arshpreet-singh -
Category
Documents
-
view
218 -
download
0
Transcript of all types of Sorting
-
8/2/2019 all types of Sorting
1/150
SORTING
By:
Name :- Arshpreet Singh
Section: - RK22H1B30
Reg No. 11107537
-
8/2/2019 all types of Sorting
2/150
-
8/2/2019 all types of Sorting
3/150
Properties
The two Main properties of sorting techniques are:
Stable: If the sorting algorithm preserves
the relative order of any two equal elements, thenthe sorting algorithm is stable.
In Place: If an algorithm does not require an extra
memory space except for few memory units, thenthe algorithm is said to be in place.
-
8/2/2019 all types of Sorting
4/150
Sorting Algorithms
Various sorting algorithms are
Bubble Sort
Selection Sort
Insertion Sort
Quick Sort Merge Sort
-
8/2/2019 all types of Sorting
5/150
Bubble Sort
This is one of the most simplest sorting
technique and most straight forward method
of sorting.
In this sorting technique, the adjacent
elements in the list are compared and
exchanged if they are out of order.
This is also called as Sinking Sort
-
8/2/2019 all types of Sorting
6/150
Time Complexity(Bubble sort)
The time complexity of bubble sort in all
three cases (best, average & worst)is
Which is not efficient compare to other sorting
techniques.
T(n) = (n^2)
-
8/2/2019 all types of Sorting
7/150
An Animated Example
674523 14 6 3398 42
1 2 3 4 5 6 7 8
to_do
index
7
N 8 did_swap true
-
8/2/2019 all types of Sorting
8/150
An Animated Example
674523 14 6 3398 42
1 2 3 4 5 6 7 8
to_do
index
7
1
N 8 did_swap false
-
8/2/2019 all types of Sorting
9/150
An Animated Example
674523 14 6 3398 42
1 2 3 4 5 6 7 8
to_do
index
7
1
N 8
Swap
did_swap false
-
8/2/2019 all types of Sorting
10/150
An Animated Example
674598 14 6 3323 42
1 2 3 4 5 6 7 8
to_do
index
7
1
N 8
Swap
did_swap true
-
8/2/2019 all types of Sorting
11/150
An Animated Example
674598 14 6 3323 42
1 2 3 4 5 6 7 8
to_do
index
7
2
N 8 did_swap true
-
8/2/2019 all types of Sorting
12/150
An Animated Example
674598 14 6 3323 42
1 2 3 4 5 6 7 8
to_do
index
7
2
N 8
Swap
did_swap true
-
8/2/2019 all types of Sorting
13/150
An Animated Example
679845 14 6 3323 42
1 2 3 4 5 6 7 8
to_do
index
7
2
N 8
Swap
did_swap true
-
8/2/2019 all types of Sorting
14/150
An Animated Example
679845 14 6 3323 42
1 2 3 4 5 6 7 8
to_do
index
7
3
N 8 did_swap true
-
8/2/2019 all types of Sorting
15/150
An Animated Example
679845 14 6 3323 42
1 2 3 4 5 6 7 8
to_do
index
7
3
N 8
Swap
did_swap true
-
8/2/2019 all types of Sorting
16/150
-
8/2/2019 all types of Sorting
17/150
An Animated Example
671445 98 6 3323 42
1 2 3 4 5 6 7 8
to_do
index
7
4
N 8 did_swap true
-
8/2/2019 all types of Sorting
18/150
An Animated Example
671445 98 6 3323 42
1 2 3 4 5 6 7 8
to_do
index
7
4
N 8
Swap
did_swap true
-
8/2/2019 all types of Sorting
19/150
An Animated Example
671445 6 98 3323 42
1 2 3 4 5 6 7 8
to_do
index
7
4
N 8
Swap
did_swap true
-
8/2/2019 all types of Sorting
20/150
An Animated Example
671445 6 98 3323 42
1 2 3 4 5 6 7 8
to_do
index
7
5
N 8 did_swap true
-
8/2/2019 all types of Sorting
21/150
An Animated Example
671445 6 98 3323 42
1 2 3 4 5 6 7 8
to_do
index
7
5
N 8
Swap
did_swap true
-
8/2/2019 all types of Sorting
22/150
An Animated Example
981445 6 67 3323 42
1 2 3 4 5 6 7 8
to_do
index
7
5
N 8
Swap
did_swap true
-
8/2/2019 all types of Sorting
23/150
An Animated Example
981445 6 67 3323 42
1 2 3 4 5 6 7 8
to_do
index
7
6
N 8 did_swap true
-
8/2/2019 all types of Sorting
24/150
An Animated Example
981445 6 67 3323 42
1 2 3 4 5 6 7 8
to_do
index
7
6
N 8
Swap
did_swap true
-
8/2/2019 all types of Sorting
25/150
An Animated Example
331445 6 67 9823 42
1 2 3 4 5 6 7 8
to_do
index
7
6
N 8
Swap
did_swap true
-
8/2/2019 all types of Sorting
26/150
An Animated Example
331445 6 67 9823 42
1 2 3 4 5 6 7 8
to_do
index
7
7
N 8 did_swap true
-
8/2/2019 all types of Sorting
27/150
An Animated Example
331445 6 67 9823 42
1 2 3 4 5 6 7 8
to_do
index
7
7
N 8
Swap
did_swap true
-
8/2/2019 all types of Sorting
28/150
An Animated Example
331445 6 67 4223 98
1 2 3 4 5 6 7 8
to_do
index
7
7
N 8
Swap
did_swap true
-
8/2/2019 all types of Sorting
29/150
After First Pass of Outer Loop
331445 6 67 4223 98
1 2 3 4 5 6 7 8
to_do
index
7
8
N 8
Finished first Bubble Up
did_swap true
-
8/2/2019 all types of Sorting
30/150
The Second Bubble Up
331445 6 67 4223 98
1 2 3 4 5 6 7 8
to_do
index
6
1
N 8 did_swap false
-
8/2/2019 all types of Sorting
31/150
The Second Bubble Up
331445 6 67 4223 98
1 2 3 4 5 6 7 8
to_do
index
6
1
N 8 did_swap false
No Swap
-
8/2/2019 all types of Sorting
32/150
The Second Bubble Up
331445 6 67 4223 98
1 2 3 4 5 6 7 8
to_do
index
6
2
N 8 did_swap false
-
8/2/2019 all types of Sorting
33/150
The Second Bubble Up
331445 6 67 4223 98
1 2 3 4 5 6 7 8
to_do
index
6
2
N 8 did_swap false
Swap
-
8/2/2019 all types of Sorting
34/150
The Second Bubble Up
334514 6 67 4223 98
1 2 3 4 5 6 7 8
to_do
index
6
2
N 8 did_swap true
Swap
-
8/2/2019 all types of Sorting
35/150
The Second Bubble Up
334514 6 67 4223 98
1 2 3 4 5 6 7 8
to_do
index
6
3
N 8 did_swap true
-
8/2/2019 all types of Sorting
36/150
The Second Bubble Up
334514 6 67 4223 98
1 2 3 4 5 6 7 8
to_do
index
6
3
N 8 did_swap true
Swap
-
8/2/2019 all types of Sorting
37/150
The Second Bubble Up
33614 45 67 4223 98
1 2 3 4 5 6 7 8
to_do
index
6
3
N 8 did_swap true
Swap
-
8/2/2019 all types of Sorting
38/150
-
8/2/2019 all types of Sorting
39/150
The Second Bubble Up
33614 45 67 4223 98
1 2 3 4 5 6 7 8
to_do
index
6
4
N 8 did_swap true
No Swap
-
8/2/2019 all types of Sorting
40/150
The Second Bubble Up
33614 45 67 4223 98
1 2 3 4 5 6 7 8
to_do
index
6
5
N 8 did_swap true
-
8/2/2019 all types of Sorting
41/150
The Second Bubble Up
33614 45 67 4223 98
1 2 3 4 5 6 7 8
to_do
index
6
5
N 8 did_swap true
Swap
-
8/2/2019 all types of Sorting
42/150
The Second Bubble Up
67614 45 33 4223 98
1 2 3 4 5 6 7 8
to_do
index
6
5
N 8 did_swap true
Swap
-
8/2/2019 all types of Sorting
43/150
The Second Bubble Up
67614 45 33 4223 98
1 2 3 4 5 6 7 8
to_do
index
6
6
N 8 did_swap true
-
8/2/2019 all types of Sorting
44/150
The Second Bubble Up
67614 45 33 4223 98
1 2 3 4 5 6 7 8
to_do
index
6
6
N 8 did_swap true
Swap
-
8/2/2019 all types of Sorting
45/150
The Second Bubble Up
42614 45 33 6723 98
1 2 3 4 5 6 7 8
to_do
index
6
6
N 8 did_swap true
Swap
-
8/2/2019 all types of Sorting
46/150
After Second Pass of Outer Loop
42614 45 33 6723 98
1 2 3 4 5 6 7 8
to_do
index
6
7
N 8 did_swap true
Finished second Bubble Up
-
8/2/2019 all types of Sorting
47/150
The Third Bubble Up
42614 45 33 6723 98
1 2 3 4 5 6 7 8
to_do
index
5
1
N 8 did_swap false
-
8/2/2019 all types of Sorting
48/150
The Third Bubble Up
42614 45 33 6723 98
1 2 3 4 5 6 7 8
to_do
index
5
1
N 8 did_swap false
Swap
-
8/2/2019 all types of Sorting
49/150
The Third Bubble Up
42623 45 33 6714 98
1 2 3 4 5 6 7 8
to_do
index
5
1
N 8 did_swap true
Swap
-
8/2/2019 all types of Sorting
50/150
The Third Bubble Up
42623 45 33 6714 98
1 2 3 4 5 6 7 8
to_do
index
5
2
N 8 did_swap true
-
8/2/2019 all types of Sorting
51/150
The Third Bubble Up
42623 45 33 6714 98
1 2 3 4 5 6 7 8
to_do
index
5
2
N 8 did_swap true
Swap
-
8/2/2019 all types of Sorting
52/150
The Third Bubble Up
42236 45 33 6714 98
1 2 3 4 5 6 7 8
to_do
index
5
2
N 8 did_swap true
Swap
-
8/2/2019 all types of Sorting
53/150
The Third Bubble Up
42236 45 33 6714 98
1 2 3 4 5 6 7 8
to_do
index
5
3
N 8 did_swap true
-
8/2/2019 all types of Sorting
54/150
The Third Bubble Up
42236 45 33 6714 98
1 2 3 4 5 6 7 8
to_do
index
5
3
N 8 did_swap true
No Swap
-
8/2/2019 all types of Sorting
55/150
The Third Bubble Up
42236 45 33 6714 98
1 2 3 4 5 6 7 8
to_do
index
5
4
N 8 did_swap true
-
8/2/2019 all types of Sorting
56/150
The Third Bubble Up
42236 45 33 6714 98
1 2 3 4 5 6 7 8
to_do
index
5
4
N 8 did_swap true
Swap
-
8/2/2019 all types of Sorting
57/150
The Third Bubble Up
42236 33 45 6714 98
1 2 3 4 5 6 7 8
to_do
index
5
4
N 8 did_swap true
Swap
-
8/2/2019 all types of Sorting
58/150
The Third Bubble Up
42236 33 45 6714 98
1 2 3 4 5 6 7 8
to_do
index
5
5
N 8 did_swap true
-
8/2/2019 all types of Sorting
59/150
The Third Bubble Up
42236 33 45 6714 98
1 2 3 4 5 6 7 8
to_do
index
5
5
N 8 did_swap true
Swap
-
8/2/2019 all types of Sorting
60/150
The Third Bubble Up
45236 33 42 6714 98
1 2 3 4 5 6 7 8
to_do
index
5
5
N 8 did_swap true
Swap
-
8/2/2019 all types of Sorting
61/150
After Third Pass of Outer Loop
45236 33 42 6714 98
1 2 3 4 5 6 7 8
to_do
index
5
6
N 8 did_swap true
Finished third Bubble Up
-
8/2/2019 all types of Sorting
62/150
The Fourth Bubble Up
45236 33 42 6714 98
1 2 3 4 5 6 7 8
to_do
index
4
1
N 8 did_swap false
-
8/2/2019 all types of Sorting
63/150
The Fourth Bubble Up
45236 33 42 6714 98
1 2 3 4 5 6 7 8
to_do
index
4
1
N 8 did_swap false
Swap
-
8/2/2019 all types of Sorting
64/150
The Fourth Bubble Up
452314 33 42 676 98
1 2 3 4 5 6 7 8
to_do
index
4
1
N 8 did_swap true
Swap
-
8/2/2019 all types of Sorting
65/150
The Fourth Bubble Up
452314 33 42 676 98
1 2 3 4 5 6 7 8
to_do
index
4
2
N 8 did_swap true
-
8/2/2019 all types of Sorting
66/150
The Fourth Bubble Up
452314 33 42 676 98
1 2 3 4 5 6 7 8
to_do
index
4
2
N 8 did_swap true
No Swap
-
8/2/2019 all types of Sorting
67/150
The Fourth Bubble Up
452314 33 42 676 98
1 2 3 4 5 6 7 8
to_do
index
4
3
N 8 did_swap true
-
8/2/2019 all types of Sorting
68/150
The Fourth Bubble Up
452314 33 42 676 98
1 2 3 4 5 6 7 8
to_do
index
4
3
N 8 did_swap true
No Swap
-
8/2/2019 all types of Sorting
69/150
The Fourth Bubble Up
452314 33 42 676 98
1 2 3 4 5 6 7 8
to_do
index
4
4
N 8 did_swap true
-
8/2/2019 all types of Sorting
70/150
The Fourth Bubble Up
452314 33 42 676 98
1 2 3 4 5 6 7 8
to_do
index
4
4
N 8 did_swap true
No Swap
-
8/2/2019 all types of Sorting
71/150
After Fourth Pass of Outer Loop
452314 33 42 676 98
1 2 3 4 5 6 7 8
to_do
index
4
5
N 8 did_swap true
Finished fourth Bubble Up
-
8/2/2019 all types of Sorting
72/150
The Fifth Bubble Up
452314 33 42 676 98
1 2 3 4 5 6 7 8
to_do
index
3
1
N 8 did_swap false
-
8/2/2019 all types of Sorting
73/150
The Fifth Bubble Up
452314 33 42 676 98
1 2 3 4 5 6 7 8
to_do
index
3
1
N 8 did_swap false
No Swap
-
8/2/2019 all types of Sorting
74/150
The Fifth Bubble Up
452314 33 42 676 98
1 2 3 4 5 6 7 8
to_do
index
3
2
N 8 did_swap false
-
8/2/2019 all types of Sorting
75/150
The Fifth Bubble Up
452314 33 42 676 98
1 2 3 4 5 6 7 8
to_do
index
3
2
N 8 did_swap false
No Swap
-
8/2/2019 all types of Sorting
76/150
The Fifth Bubble Up
452314 33 42 676 98
1 2 3 4 5 6 7 8
to_do
index
3
3
N 8 did_swap false
-
8/2/2019 all types of Sorting
77/150
The Fifth Bubble Up
452314 33 42 676 98
1 2 3 4 5 6 7 8
to_do
index
3
3
N 8 did_swap false
No Swap
f f f
-
8/2/2019 all types of Sorting
78/150
After Fifth Pass of Outer Loop
452314 33 42 676 98
1 2 3 4 5 6 7 8
to_do
index
3
4
N 8 did_swap false
Finished fifth Bubble Up
-
8/2/2019 all types of Sorting
79/150
Selection Sort
In this technique first we find the smallest item in the
list and we exchange it with the first item.
Next, obtain the second smallest item in the list &
exchange it with the second element and so on. Since, the next least item is selected and exchanged
appropriately so that elements are finally sorted ,this
technique is called Selection Sort
-
8/2/2019 all types of Sorting
80/150
Time Complexity(Selection sort)
The time complexity of selection sort in all
three cases (best, average& worst) is
Which is not efficient compare to other sorting
techniques.
T(n) = (n^2)
S l i S
-
8/2/2019 all types of Sorting
81/150
Selection Sort
5 1 3 4 6 2
Comparison
Data Movement
Sorted
S l i S
-
8/2/2019 all types of Sorting
82/150
Selection Sort
5 1 3 4 6 2
Comparison
Data Movement
Sorted
S l i S
-
8/2/2019 all types of Sorting
83/150
Selection Sort
5 1 3 4 6 2
Comparison
Data Movement
Sorted
S l i S
-
8/2/2019 all types of Sorting
84/150
Selection Sort
5 1 3 4 6 2
Comparison
Data Movement
Sorted
S l ti S t
-
8/2/2019 all types of Sorting
85/150
Selection Sort
5 1 3 4 6 2
Comparison
Data Movement
Sorted
S l ti S t
-
8/2/2019 all types of Sorting
86/150
Selection Sort
5 1 3 4 6 2
Comparison
Data Movement
Sorted
S l ti S t
-
8/2/2019 all types of Sorting
87/150
Selection Sort
5 1 3 4 6 2
Comparison
Data Movement
Sorted
S l ti S t
-
8/2/2019 all types of Sorting
88/150
Selection Sort
5 1 3 4 6 2
LargestComparison
Data Movement
Sorted
S l ti S t
-
8/2/2019 all types of Sorting
89/150
Selection Sort
5 1 3 4 2 6
Comparison
Data Movement
Sorted
S l ti S t
-
8/2/2019 all types of Sorting
90/150
Selection Sort
5 1 3 4 2 6
Comparison
Data Movement
Sorted
S l ti S t
-
8/2/2019 all types of Sorting
91/150
Selection Sort
5 1 3 4 2 6
Comparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
92/150
Selection Sort
5 1 3 4 2 6
Comparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
93/150
Selection Sort
5 1 3 4 2 6
Comparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
94/150
Selection Sort
5 1 3 4 2 6
Comparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
95/150
Selection Sort
5 1 3 4 2 6
Comparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
96/150
Selection Sort
5 1 3 4 2 6
Largest
Comparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
97/150
Selection Sort
2 1 3 4 5 6
Comparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
98/150
Selection Sort
2 1 3 4 5 6
Comparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
99/150
Selection Sort
2 1 3 4 5 6
Comparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
100/150
Selection Sort
2 1 3 4 5 6
Comparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
101/150
Selection Sort
2 1 3 4 5 6
Comparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
102/150
Selection Sort
2 1 3 4 5 6
Comparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
103/150
Selection Sort
2 1 3 4 5 6
LargestComparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
104/150
Selection Sort
2 1 3 4 5 6
Comparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
105/150
Selection Sort
2 1 3 4 5 6
Comparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
106/150
Selection Sort
2 1 3 4 5 6
Comparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
107/150
Selection Sort
2 1 3 4 5 6
Comparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
108/150
Selection Sort
2 1 3 4 5 6
Comparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
109/150
Selection Sort
2 1 3 4 5 6
LargestComparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
110/150
Selection Sort
2 1 3 4 5 6
Comparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
111/150
Selection Sort
2 1 3 4 5 6
Comparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
112/150
Selection Sort
2 1 3 4 5 6
Comparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
113/150
Selection Sort
2 1 3 4 5 6
Comparison
Data Movement
Sorted
Selection Sort
-
8/2/2019 all types of Sorting
114/150
Selection Sort
2 1 3 4 5 6
Largest
Comparison
Data Movement
Sorted
-
8/2/2019 all types of Sorting
115/150
Selection Sort
-
8/2/2019 all types of Sorting
116/150
Selection Sort
1 2 3 4 5 6
DONE!ComparisonData Movement
Sorted
Insertion Sort
-
8/2/2019 all types of Sorting
117/150
se t o So t
In this technique the given list is divided into twoparts:sorted part(left) &unsorted part(right).
The unsorted elements can be placed any of thepositions in the sorted part so that elements towardsleft of boundary are sorted.
As each item is inserted towards the sorted left part,the boundary moves to the right decreasing theunsorted list.
Finally,once the boundary moves to the right most
position,the elements towards the left of boundaryrepresent the sorted list.
l ( )
-
8/2/2019 all types of Sorting
118/150
Time Complexity(Insertion sort)
The Time complexity of insertion sort is:
Worst case:
Average case:
Best case:
T(n) = (n^2)
T(n) = O(n^2)
T(n) = (n)
Insertion Sort
-
8/2/2019 all types of Sorting
119/150
Insertion Sort
23 17 45 18 12 22
Insertion Sort
-
8/2/2019 all types of Sorting
120/150
Insertion Sort
23 17 45 18 12 22
1 2 6543
Insertion Sort
-
8/2/2019 all types of Sorting
121/150
Insertion Sort
23 17 45 18 12 22
1 2 6543
1 2 6543
Insertion Sort
-
8/2/2019 all types of Sorting
122/150
Insertion Sort
23
17 45 18 12 22
1 2 6543
1 2 6543
Insertion Sort
-
8/2/2019 all types of Sorting
123/150
2317
45 18 12 22
1 2 6543
1 2 6543
Insertion Sort
-
8/2/2019 all types of Sorting
124/150
2317 45
18 12 22
1 2 6543
1 2 6543
Insertion Sort
-
8/2/2019 all types of Sorting
125/150
2317 4518
12 22
1 2 6543
1 2 6543
Insertion Sort
-
8/2/2019 all types of Sorting
126/150
2317 4518
12 22
1 2 6543
1 2 6543
Insertion Sort
-
8/2/2019 all types of Sorting
127/150
2317 451812
22
1 2 6543
1 2 6543
Insertion Sort
-
8/2/2019 all types of Sorting
128/150
2317 451812
22
1 2 6543
1 2 6543
Insertion Sort
-
8/2/2019 all types of Sorting
129/150
1812 2217 23 45
1 2 6543
1 2 6543
Merge sort
-
8/2/2019 all types of Sorting
130/150
g
In merge sort, a given array of elements is dividedinto two parts.
The left part of the array as well as the right part of
the array is sorted recursively.
Later, the sorted left part and the sorted right part
are finally merged into a single sorted vector.
The process of merging of two sorted vectors into
a single sorted vector is called simple merge.
Time complexity(Merge sort)
-
8/2/2019 all types of Sorting
131/150
Time complexity(Merge sort)
The time complexity of Merge sort in all threecases (best,average&worst) is:
T(n) = (nlog2n)
Merge Sort
-
8/2/2019 all types of Sorting
132/150
1062 5 3 19 7
1 2 3 4 5 6 7 8
Merge Sort
-
8/2/2019 all types of Sorting
133/150
1062 5 3 19 7
1 2 3 4 5 6 7 8
Merge Sort
-
8/2/2019 all types of Sorting
134/150
Greatest Digit comes
first Place
1062 5 3 19 7
2 9
Merge Sort
-
8/2/2019 all types of Sorting
135/150
1062 5 3 19 7
1 72 9 3 105 6
Merge Sort
-
8/2/2019 all types of Sorting
136/150
1062 5 3 19 7
1 72 9 3 105 6
2
Greatest Digit comes first Place
Merge Sort
-
8/2/2019 all types of Sorting
137/150
1062 5 3 19 7
1 72 9 3 105 6
2 5
Greatest Digit comes first Place
Merge Sort
-
8/2/2019 all types of Sorting
138/150
1062 5 3 19 7
1 72 9 3 105 6
2 5 6
Greatest Digit comes first Place
Merge Sort
-
8/2/2019 all types of Sorting
139/150
1062 5 3 19 7
1 72 9 3 105 6
2 5 6 9
Merge Sort
-
8/2/2019 all types of Sorting
140/150
1062 5 3 19 7
1 72 9 3 105 6
2 5 6 9 1 3 7 10
Merge Sort
-
8/2/2019 all types of Sorting
141/150
1062 5 3 19 7
1 72 9 3 105 6
2 5 6 9 1 3 7 10
1
Merge Sort
-
8/2/2019 all types of Sorting
142/150
106
25
3 19 7
1 72 9 3 105 6
2 5 6 9 1 3 7 10
1 2
Merge Sort
-
8/2/2019 all types of Sorting
143/150
106
25
3 19 7
1 72 9 3 105 6
2 5 6 9 1 3 7 10
1 2 3
Merge Sort
-
8/2/2019 all types of Sorting
144/150
106
25
3 19 7
1 72 9 3 105 6
2 5 6 9 1 3 7 10
1 2 3 5
Merge Sort
-
8/2/2019 all types of Sorting
145/150
106
25
3 19 7
1 72 9 3 105 6
2 5 6 9 1 3 7 10
1 2 3 5 6
Merge Sort
-
8/2/2019 all types of Sorting
146/150
106
25
3 19 7
1 72 9 3 105 6
2 5 6 9 1 3 7 10
1 2 3 5 6 7
Merge Sort
-
8/2/2019 all types of Sorting
147/150
106
25 3
19
7
1 72 9 3 105 6
2 5 6 9 1 3 7 10
1 2 3 5 6 7 9
Merge Sort
-
8/2/2019 all types of Sorting
148/150
106
25 3
19
7
1 72 9 3 105 6
2 5 6 9 1 3 7 10
1 2 3 5 6 7 9 10
Conclusion
-
8/2/2019 all types of Sorting
149/150
Conclusion
By comparing all the sorting techniquesMerge sort time complexity is less in all three
cases (time consuming is less).
So, Merge sort is the most efficient techniquewhen compare to all other sorting techniques.
-
8/2/2019 all types of Sorting
150/150
THANK YOU