Merge Sort

sorry

Merge sort is an effecient, all-purpose sorting algorithm. It is a divide and conquer algorithm, which means it divides the list of elements into groups and individually sorts them.


From a list, split it into 2 sublists, each containing about half of the elements. Keep dividing until you have 1 or 2 elements in each sublist. Then, sort the sublists by putting the lesser value on the left and higher value on the right. Then, return the sublists by merging 2 sublists into one sorted sequence. Keep merging each sorted sequence until you end up with the final sorted list.


More about mergesort