romanjoy / romp-ryo-sevensixteen

0 stars 0 forks source link

Think of Merge Sort & How to understand Divide And Conquer #7

Closed romanjoy closed 2 years ago

romanjoy commented 3 years ago

Divide

This involves dividing the problem into smaller sub-problems.

Conquer

Solve sub-problems by calling recursively until solved.

Combine

Combine the sub-problems to get the final solution of the whole problem.

Merge Sort Process

mergesort

Recursive Formula

merge_sort (p...r) = merge(merge_sort (p...q), merge(q+1...r)) if (p>=r) over