Let's begin!
We've learned that Merge Sort is a sorting algorithm which follows the principle of Divide and Conquer and it have average time complexity as n(log n).
I have used two functions to implement Merge Sort:
1. Merge Sort (To Produce Sub Array)
- It will divide array in two parts form left to mid and mid+1 to end.
- It will produce sub array until it's a single element.
- It will sort the array by comparing elements in left array and right array and store it into temporary array.
- It will save the remaining value.
- It will copy the temporary array into main array
Good going 👌✌️
ReplyDelete