logo

Divide And Conquer



Divide And Conquer, an art of war ...

This is a strategy where we divide the problem into smaller sub-problems. By solving the smaller sub-problems, we obtain the solution for the main problem. This strategy was said to be used by the great Napolean himself ...

Under this paradigm, we will be learning Merge Sort :

The algorithm goes like this ...

  • We partition the input array into two halves and keep on partitioning until the array is indivisible (length <= 2)
  • We then sort these partitions separately and merge them pairwise.
  • Finally, we get the sorted array.

Click the button below to see how merge sort works ...