Merge Sort MCQ Quiz - Objective Question with Answer for Merge Sort - Download Free PDF
Last updated on Jun 10, 2025
Latest Merge Sort MCQ Objective Questions
Merge Sort Question 1:
Time complexity of Merge Sort Algorithm and Binary Search Algorithm are respectively:
Answer (Detailed Solution Below)
Merge Sort Question 1 Detailed Solution
Merge sort
It is based on the divide and conquers approach.
Recurrence relation for merge sort will become:
T(n) = 2T (n/2) + Θ (n)
Using Master’s theorem
T (n) = n × log2n
Therefore, the time complexity of Merge Sort is θ(nlogn).
Binary Search
Search a sorted array by repeatedly dividing the search interval in half.
Recurrence for binary search is T(n) = T(n/2) + θ(1)
Using Master’s theorem
T (n) = log2n
Consider only half of the input list and throw out the other half. Hence time complexity is O(log n).
Merge Sort Question 2:
Merge Sort is an example of which algorithm design paradigm?
Answer (Detailed Solution Below)
Merge Sort Question 2 Detailed Solution
The correct answer is Divide and Conquer.
Key Points
- Merge Sort is an efficient, stable, and comparison-based sorting algorithm.
- It follows the Divide and Conquer paradigm, which means it divides the array into smaller subarrays, sorts those subarrays, and then merges them back together to form the sorted array.
- The algorithm recursively divides the array into two halves until each subarray contains a single element or no elements (base case).
- After dividing the array, it then merges the subarrays in a sorted manner to produce the final sorted array.
- The time complexity of Merge Sort is O(n log n), making it very efficient for large datasets.
Additional Information
- Merge Sort is a stable sort, meaning that it preserves the relative order of equal elements.
- It is also an out-of-place sort as it requires additional space proportional to the size of the input array.
- Because of its consistent O(n log n) time complexity, it performs well on large datasets and is used in various applications.
- Merge Sort is especially useful for linked lists and external sorting (where data doesn't fit into memory).
Merge Sort Question 3:
Which of the following is the worst-case time complexity of the merge-sort algorithm?
Answer (Detailed Solution Below)
Merge Sort Question 3 Detailed Solution
The correct answer is option 1.
Concept:
Merge-sort algorithm:
Merge Sort is a Divide and Conquer algorithm. It divides the input array into 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 a key process that assumes that arr[l..m] and arr[m+1..r] are sorted and merges the two sorted sub-arrays into one.
Algorithm:
MergeSort(arr[ ], l, r)
If r > l
- Find the middle point to divide the array into two halves: middle m = l+ (r-l)/2
- Call mergeSort for first half: Call mergeSort(arr, l, m)
- Call mergeSort for second half: Call mergeSort(arr, m+1, r)
- Merge the two halves sorted in steps 2 and 3: Call merge(arr, l, m, r)
Time complexity:
Sorting arrays on different machines. Merge Sort is a recursive algorithm and time complexity can be expressed as following recurrence relation.
T(n) = 2T(n/2) + θ(n)
Worst case= Θ(n lg n)
Best case= Θ(n lg n)
Average case= Θ(n lg n)
Hence the correct answer is Θ(n lg n).
Merge Sort Question 4:
Which of the following is the worst-case time complexity of the merge-sort algorithm?
Answer (Detailed Solution Below)
Merge Sort Question 4 Detailed Solution
The correct answer is option 1.
Concept:
Merge-sort algorithm:
Merge Sort is a Divide and Conquer algorithm. It divides the input array into 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 a key process that assumes that arr[l..m] and arr[m+1..r] are sorted and merges the two sorted sub-arrays into one.
Algorithm:
MergeSort(arr[ ], l, r)
If r > l
- Find the middle point to divide the array into two halves: middle m = l+ (r-l)/2
- Call mergeSort for first half: Call mergeSort(arr, l, m)
- Call mergeSort for second half: Call mergeSort(arr, m+1, r)
- Merge the two halves sorted in steps 2 and 3: Call merge(arr, l, m, r)
Time complexity:
Sorting arrays on different machines. Merge Sort is a recursive algorithm and time complexity can be expressed as following recurrence relation.
T(n) = 2T(n/2) + θ(n)
Worst case= Θ(n lg n)
Best case= Θ(n lg n)
Average case= Θ(n lg n)
Hence the correct answer is Θ(n lg n).
Merge Sort Question 5:
Which of the following sort algorithms has execution time that is least dependent on initial ordering of the input?
Answer (Detailed Solution Below)
Merge Sort Question 5 Detailed Solution
Option_1: Insertion Sort
In Insertion sort, if the array is already sorted, then it takes O(n) time and if it is sorted is decreasing order, then it takes O(n2) time to sort the array.
Option_2: Quick Sort
In Quick sort, if the array is already sorted whether in decreasing or in non-decreasing order, then it takes O(n2) time.
Option_3 – Merge Sort
Merge sort gives time complexity of O(nlogn) in every case, be it best, average or worst. In merge sort, performance is affected least by the order of input sequence.
Option_4: Selection Sort
For selection sort, the best- case and worst-case performance of Selection is O(n2) only. But if the array is already sorted then less swaps are required.Top Merge Sort MCQ Objective Questions
Suppose P, Q, R, S, T are sorted sequences having lengths 20, 24, 30, 35, 50 respectively. They are to be merged into a single sequence by merging together two sequences at a time. The number of comparisons that will be needed in the worst case by the optimal algorithm for doing this is ____.
Answer (Detailed Solution Below) 358
Merge Sort Question 6 Detailed Solution
Download Solution PDFGiven sequence: 20, 24, 30, 35, 50
Ascending order: 20, 24, 30, 35, 50
Merge(20, 24) → new size (44)
Number of comparisons = 20 + 24 – 1 = 43
Sequence: 30, 35, 44, 50
Merge(30, 35) → new size (65)
Number of comparisons = 30 + 35 – 1 = 64
Sequence: 44, 50, 65
Merge(44, 50) → new size (94)
Number of comparisons = 44 + 50 – 1 = 93
Sequence: 65, 94
Merge(65, 94) → new size (150)
Number of comparisons = 65 + 94 – 1 = 158
Therefore, total number of comparisons, 43 + 64 + 93 + 158 = 358Which of the following sort algorithms has execution time that is least dependent on initial ordering of the input?
Answer (Detailed Solution Below)
Merge Sort Question 7 Detailed Solution
Download Solution PDFOption_1: Insertion Sort
In Insertion sort, if the array is already sorted, then it takes O(n) time and if it is sorted is decreasing order, then it takes O(n2) time to sort the array.
Option_2: Quick Sort
In Quick sort, if the array is already sorted whether in decreasing or in non-decreasing order, then it takes O(n2) time.
Option_3 – Merge Sort
Merge sort gives time complexity of O(nlogn) in every case, be it best, average or worst. In merge sort, performance is affected least by the order of input sequence.
Option_4: Selection Sort
For selection sort, the best- case and worst-case performance of Selection is O(n2) only. But if the array is already sorted then less swaps are required.Assume that a mergesort algorithm in the worst case takes 30 seconds for an input of size 64.
Which of the following most closely approximates the maximum input size of a problem that can be solved in 6 minutes?Answer (Detailed Solution Below)
Merge Sort Question 8 Detailed Solution
Download Solution PDFConcept:
Merge sort algorithm worst case time complexity is O (nlogn)
Data:
T1 (n) =30 seconds, n1 = 64
T2 (n) = 6 minutes
Formula:
T(n) = nlog2n
Calculation:
30 = c × 64 log2(64)
30 = c × 64 log2(26)
30 = c × 64 × 6
\(c = \frac{5}{{64}}\)
6 × 30 = c n2 log2n2
\(6 \times 60 = \frac{5}{{64}} \times {n_2}{\log _2}{n_2}\)
∴ n2 = 512
The maximum input size of a problem that can be solved in 6 minutes is 512Which of the following is the worst-case time complexity of the merge-sort algorithm?
Answer (Detailed Solution Below)
Merge Sort Question 9 Detailed Solution
Download Solution PDFThe correct answer is option 1.
Concept:
Merge-sort algorithm:
Merge Sort is a Divide and Conquer algorithm. It divides the input array into 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 a key process that assumes that arr[l..m] and arr[m+1..r] are sorted and merges the two sorted sub-arrays into one.
Algorithm:
MergeSort(arr[ ], l, r)
If r > l
- Find the middle point to divide the array into two halves: middle m = l+ (r-l)/2
- Call mergeSort for first half: Call mergeSort(arr, l, m)
- Call mergeSort for second half: Call mergeSort(arr, m+1, r)
- Merge the two halves sorted in steps 2 and 3: Call merge(arr, l, m, r)
Time complexity:
Sorting arrays on different machines. Merge Sort is a recursive algorithm and time complexity can be expressed as following recurrence relation.
T(n) = 2T(n/2) + θ(n)
Worst case= Θ(n lg n)
Best case= Θ(n lg n)
Average case= Θ(n lg n)
Hence the correct answer is Θ(n lg n).
Merge sort uses:
Answer (Detailed Solution Below)
Merge Sort Question 10 Detailed Solution
Download Solution PDF- Merge sort is an efficient sorting algorithm that uses a divide-and-conquer approach to order elements in an array.
- Mergesort has two steps:
- Merging
- Sorting.
- The algorithm uses a divide-and-conquer approach to merge and sort a list.
The recursive mergesort algorithm is
1. If the list has only one element, Return the list and terminate. (Base case)
2. Split the list into two halves that are as equal in length as possible. (Divide)
3. Using recursion, sort both lists using mergesort. (Conquer)
4. Merge the two sorted lists and return the result. (Combine)
If one uses straight two-way merge sort algorithm to sort the following elements in ascending order 20, 47, 15, 8, 9, 4, 40, 30, 12, 17 then the order of these elements after the second pass of the algorithm is:
Answer (Detailed Solution Below)
Merge Sort Question 11 Detailed Solution
Download Solution PDFThe correct answer is option 2.
Key Points
- Two-way merge sort algorithm to sort the following elements in ascending order 20, 47, 15, 8, 9, 4, 40, 30, 12, 17
Hence, after the 2nd pass list would be 8, 15, 20, 47, 4, 9, 30 40, 12, 17
Additional Information
- Sorting arrays through several computers. Merge Sort is a recursive algorithm with the following recurrence relation for time complexity.
- T(n) = 2T(n/2) + θ(n)
- Time complexity two-way merge sort is O(N log N)
- complete merge sort process for an example array {38, 27, 43, 3, 9, 82, 10}
Of the following sorting algorithms, which has a running time that is least dependent on the initial ordering of the input?
Answer (Detailed Solution Below)
Merge Sort Question 12 Detailed Solution
Download Solution PDFMerge sort:
Merge sort complexity is independent of the distribution of data. Merge sort is based on the divide and conquer approach. Recurrence relation for merge sort will become:
T(n) = 2T (n/2) + Θ (n)
T(n) = n + Θ (n)
T (n) = n × logn
Merge sorting algorithms, running time complexity is least dependent on the initial ordering of the input that is O(n × log2n)
Insertion sort:
In Insertion sort, the worst-case takes Θ (n2) time, the worst case of insertion sort is when elements are sorted in reverse order. In that case the number of comparisons will be like:
\(\mathop \sum \limits_{{\rm{p}} = 1}^{{\rm{N}} - 1} {\rm{p}} = 1 + 2 + 3 + \ldots . + {\rm{N}} - 1 = {\rm{\;}}\frac{{{\rm{N}}\left( {{\rm{N}} - 1} \right)}}{2} - 1\)
This will give Θ (n2) time complexity.
Quicksort:
In Quicksort, the worst-case takes Θ (n2) time. The worst case of quicksort is when the first or the last element is chosen as the pivot element.
\(\mathop \sum \limits_{{\rm{p}} = 1}^{{\rm{N}} - 1} {\rm{p}} = 1 + 2 + 3 + \ldots . + {\rm{N}} - 1 = {\rm{\;}}\frac{{{\rm{N}}\left( {{\rm{N}} - 1} \right)}}{2} - 1\)
This will give Θ (n2) time complexity.
Recurrence relation for quick sort algorithm will be,
T (n) = T (n-1) + Θ (n)
This will give the worst-case time complexity as Θ (n2).
It is clear that quick sort and insertion sort time complexity depend on the input sequence
Important Point
Algorithm |
Best-case (Ω) |
Average-case (Θ) |
Worst-case(O) |
Merge sort |
n × log2n |
n × log2n |
n × log2n |
Quicksort |
n × log2 n |
n2 |
n2 |
Insertion sort | n | n2 | n2 |
Selection sort |
n2 |
n2 |
n2 |
What is mean by stable sorting algorithm?
Answer (Detailed Solution Below)
Merge Sort Question 13 Detailed Solution
Download Solution PDFConcept
The stability of a sorting algorithm is concerned with how the algorithm treats equal (or repeated) elements.
A sorting algorithm is said to be stable if two objects with equal keys appear in the same order in sorted output as they appear in the input array to be sorted.
Some sorting algorithms are stable by nature like Insertion sort, Merge Sort, Bubble Sort, etc. And some sorting algorithms are not, like Heap Sort, Quick Sort, etc.
The worst-case running times of Insertion sort, Merge sort and Quick sort, respectively, are:
Answer (Detailed Solution Below)
Merge Sort Question 14 Detailed Solution
Download Solution PDFInsertion sort:
In Insertion sort, the worst-case takes Θ (n2) time, the worst case of insertion sort is when elements are sorted in reverse order. In that case the number of comparisons will be like:
\(\mathop \sum \limits_{{\rm{p}} = 1}^{{\rm{N}} - 1} {\rm{p}} = 1 + 2 + 3 + \ldots . + {\rm{N}} - 1 = {\rm{\;}}\frac{{{\rm{N}}\left( {{\rm{N}} - 1} \right)}}{2} - 1\)
This will give Θ (n2) time complexity.
Merge sort:
In Merge sort, the worst-case takes Θ (n log n) time. Merge sort is based on the divide and conquer approach. Recurrence relation for merge sort will become:
T(n) = 2T (n/2) + Θ (n)
T(n) = n + Θ (n)
T (n) = n × logn
Quicksort:
In Quicksort, the worst-case takes Θ (n2) time. The worst case of quicksort is when the first or the last element is chosen as the pivot element.
Diagram
\(\mathop \sum \limits_{{\rm{p}} = 1}^{{\rm{N}} - 1} {\rm{p}} = 1 + 2 + 3 + \ldots . + {\rm{N}} - 1 = {\rm{\;}}\frac{{{\rm{N}}\left( {{\rm{N}} - 1} \right)}}{2} - 1\)
This will give Θ (n2) time complexity.
Recurrence relation for quick sort algorithm will be,
T (n) = T (n-1) + Θ (n)
This will give the worst-case time complexity as Θ (n2).
What is the complexity of Merge Sort?
Answer (Detailed Solution Below)
Merge Sort Question 15 Detailed Solution
Download Solution PDFMerge sort:
Merge sort is based on the divide and conquer approach.
Recurrence relation for merge sort will become:
T(n) = 2T (n/2) + Θ (n)
Using Master’s theorem
T (n) = n × log2n
Therefore, the time complexity of Merge Sort is θ(nlogn).