This power point presentation will give you the knowledge of merge sort algorithm how it works with a given problem solving example. It also describe about the time complexity of merge sort algorithm, and the program in c .
2. Definition:-
Merge sort is one of the most efficient sorting algorithms. It works
on the principle of Divide and Conquer. Merge sort repeatedly
breaks down a list into several sub lists until each sub list consists
of a single element and merging those sub lists in a manner that
results into a sorted list.
Divide and conquer rule:-
A divide-and-conquer algorithm recursively breaks down a
problem into two or more sub-problems of the same or
related type, until these become simple enough to be solved
directly. The solutions to the sub-problems are then
combined to give a solution to the original problem.
7. Time complexity:-
Merge Sort is a recursive algorithm and time
complexity can be expressed as following recurrence
relation.
T(n) = 2T(n/2) + n
Recurrence tree method:-
Recursion Tree is another method for solving the recurrence
relations. A recursion tree is a tree where each node represents the cost
of a certain recursive sub-problem. We sum up the values in each node
to get the cost of the entire algorithm.
8.
9.
10. The solution of the above recurrence is O(nLogn). The list
of size N is divided into a max of Logn parts, and the
merging of all sublists into a single list takes O(N) time, the
worst-case run time of this algorithm is O(nLogn)
Best Case Time Complexity: O(n*log n)
Worst Case Time Complexity: O(n*log n)
Average Time Complexity: O(n*log n)
The time complexity of MergeSort is O(n*Log n) in all the 3
cases (worst, average and best) as the mergesort always
divides the array into two halves and takes linear time to
merge two halves.