Q. In Merge Sort, what is the time complexity for merging two sorted arrays?
-
A.
O(n)
-
B.
O(n log n)
-
C.
O(log n)
-
D.
O(n^2)
Solution
Merging two sorted arrays takes O(n) time, where n is the total number of elements in both arrays.
Correct Answer:
A
— O(n)
Learn More →
Q. What is the best-case time complexity of Quick Sort?
-
A.
O(n)
-
B.
O(n log n)
-
C.
O(log n)
-
D.
O(n^2)
Solution
The best-case time complexity of Quick Sort is O(n log n), which occurs when the pivot divides the array into two equal halves.
Correct Answer:
B
— O(n log n)
Learn More →
Q. What is the primary advantage of Quick Sort over Merge Sort?
-
A.
Less memory usage
-
B.
Faster average case
-
C.
Easier implementation
-
D.
Stable sorting
Solution
Quick Sort generally uses less memory than Merge Sort because it sorts in place.
Correct Answer:
A
— Less memory usage
Learn More →
Q. Which of the following is a characteristic of Heap Sort?
-
A.
It is a stable sort
-
B.
It is an in-place sort
-
C.
It is a recursive sort
-
D.
It requires additional memory
Solution
Heap Sort is an in-place sorting algorithm, meaning it does not require additional storage proportional to the input size.
Correct Answer:
B
— It is an in-place sort
Learn More →
Q. Which of the following sorting algorithms is not a comparison-based sort?
-
A.
Merge Sort
-
B.
Quick Sort
-
C.
Heap Sort
-
D.
Counting Sort
Solution
Counting Sort is not a comparison-based sort; it uses counting to determine the position of each element.
Correct Answer:
D
— Counting Sort
Learn More →
Q. Which sorting algorithm is stable among the following?
-
A.
Quick Sort
-
B.
Heap Sort
-
C.
Merge Sort
-
D.
Selection Sort
Solution
Merge Sort is a stable sorting algorithm, meaning it maintains the relative order of equal elements.
Correct Answer:
C
— Merge Sort
Learn More →
Showing 1 to 6 of 6 (1 Pages)