Comparison of All Sorting Algorithms
Comparison of All Sorting Algorithms
Algorithms
Presentation
By
G.Gopi Krishna Reddy
Sorting
The Process of rearranging the elements
so that they are in ascending order or
descending order is called sorting.
Example:
arranging of numbers, student records.
very essential for searching the
dictionaries, telephone directories.
Properties
The two Main properties of sorting techniques are:
Bubble Sort
Selection Sort
Insertion Sort
Quick Sort
Merge Sort
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
Time Complexity(Bubble sort)
The time complexity of bubble sort in all
three cases (best,average & worst)is
T(n) = (n^2)
Best case:
T(n) = O(n log n)
Merge sort
In merge sort, a given array of elements is
divided into 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)
The time complexity of Merge sort in all
three cases (best,average&worst) is:
T(n) = (nlog2n)
Conclusion
By comparing all the sorting techniques
Merge sort time complexity is less in all
three cases (time consuming is less).
So, Merge sort is the most efficient
technique when compare to all other
sorting techniques.
THANK YOU