00:01
Hello students, as the merge sort is popular comparison based sorting algorithm known for its efficiency and its stability.
00:19
So whereas it follows the divide and conquer strategy to sort a list of an element.
00:26
So here is how the merge sort works.
00:31
First it goes for a divide.
00:35
So in the divide, the input array is divided into the two halves.
00:40
So it is divided into the two halves recursively until each subarray contains only one element.
00:47
And then the second step is of the conquer.
00:50
So in a conquer, the individual elements are merged in a sorted manner.
00:55
This is done by the repeatedly selecting the smallest element from the two subarray and merging them into a new sorted subarray.
01:04
The third step is to combine.
01:07
So as the subarray are merged back together to create a fully sorted array.
01:18
So here is an example of a merge sort where you will first initialize all the int of n1, n2 with the left array and the right array and then you will copy the array down to the temporary array of left array and the right array.
01:39
Then you will merge the temporary array back to the array of its left and right...