India Languages, asked by seema02, 9 months ago

How many passes will be needed to sort an array which contains 5 elements using Merge Sort​

Answers

Answered by utk18th
9

Answer:

Like QuickSort, Merge Sort is a Divide and Conquer algorithm. It divides input array in two halves, calls itself for the two halves and then merges the two sorted halves. The merge() function is used for merging two halves. The merge(arr, l, m, r) is key process that assumes that arr[l..m] and arr[m+1..r] are sorted and merges the two sorted sub-arrays into one. See following C implementation for details.

Explanation:

pls mark me as a brainlist bro

Answered by mad210215
0

Given :

              An array contains 5 elements.

Explanation:

Merge sort follows the property of 'divide and conquer' to sort elements of an array.

It divides an array further and further until it gets sorted & then it combines the sorted array in reverse order.

Consider the following example,  you will understand that 5 passes are required to sort an array by using merge sort.

Attachments:
Similar questions