The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time. Tom Cargill
Merge sort is a divide and conquer and comparison-based sorting algorithm. It divide the array into subarray and conquer by recursively sorting two subarrays. It combines the results into the final array.
Divide the problem into small subproblems.
Solve the subproblem using recursive function.
Combine the sub solution into solution.
Merge sort can be implemented the Top-down or Bottom-up approach. Top down merge sort split the list into sub list and sort the sub list. Finally, it merge sorted sublist into single sorted list. Bottom up merge sort treats array of sub list and iteratively merges sub-lists back and forth between two buffers. Merge sort uses for linked list sorting, external sorting on the tab. It is stable sort compare then another sorting algorithm.
Write a program to take the un-sorted array and sort the array using Merge sort.
Unsorted array before sorting: [12, 11, 13, 5, 6, 7] Sorted array After Merge sort sorting: [5, 6, 7, 11, 12, 13]