In merge sort, what is the maximum number of comparisons required to merge two sorted subarrays of size 'm' and 'n' into a single sorted array of size 'm+n'?
m * n
m + n
m + n - 1
m * n - 1
What is the primary data structure used in Heap Sort?
Binary Heap
Stack
Linked List
Queue
Which of the following is NOT a valid approach for array rotation?
Block Swap Algorithm
Juggling Algorithm
Reversal Algorithm
Merge Sort Algorithm
You are searching for a target value in a 2D matrix where each row and column is sorted in ascending order. Which search algorithm is the most efficient?
Staircase Search
Linear Search
Binary Search on each row
Breadth First Search
What is the time complexity of resizing a dynamic array (like ArrayList in Java or vector in C++) when it becomes full?
O(1)
O(n log n)
O(n)
O(log n)
Rotating an array by 'k' positions to the right means:
Reversing the entire array.
Shifting each element 'k' positions to the right.
Sorting the array in descending order.
Shifting each element 'k' positions to the left.
Quick Sort is generally considered faster than Merge Sort in practice. What is one of the main reasons for this?
Quick Sort has better space complexity than Merge Sort.
Quick Sort is a stable sorting algorithm, while Merge Sort is not.
Quick Sort has better time complexity in all cases.
Quick Sort typically has smaller constant factors in its time complexity.
What is the time complexity of inserting an element into a Max Heap containing 'n' elements?
You have a sorted array of 1000 elements. What is the maximum number of comparisons a binary search algorithm would need to find a target element or determine it's not present?
1000
100
10
500
What is the time complexity of deleting a given value from an unsorted array in the worst case?