Question:

Write a program to perform merge sort on [85,63,0,12,47,96,52]

Program:

Explanation:

Step 1 − if it is only one element in the list it is already sorted, return.

Step 2 − divide the list recursively into two halves until it can no more be divided.

Step 3 − merge the smaller lists into new list in sorted order.

Output:

 

Leave a Reply