Which of the following statements is TRUE about Quick Sort?
It always has a time complexity of O(n log n).
It is generally preferred over Merge Sort for arrays.
It performs poorly on already sorted arrays if the pivot selection is not optimized.
It is a stable sorting 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?
Breadth First Search
Linear Search
Staircase Search
Binary Search on each row
What is the time complexity of searching for a target value in a sorted array using binary search?
O(n)
O(log n)
O(1)
O(n log n)
What is the time complexity of resizing a dynamic array (like ArrayList in Java or vector in C++) when it becomes full?
You are given a sorted array and a target value to insert. Which algorithm offers the best time complexity for inserting the target value while maintaining the sorted order?
Bubble Sort
Binary Search
Quick Sort
What is the time complexity of deleting a given value from an unsorted array in the worst case?
You need to rotate an array by a very large 'k'. What optimization can be applied to improve efficiency?
Calculate the effective rotation (k % n) where n is the array length.
Sort the array before rotation.
Use a temporary array to store elements.
No optimization is possible for large 'k'.
Which sorting algorithm has the least space complexity among Merge Sort, Quick Sort, and Heap Sort?
Heap Sort
Merge Sort
What is the time complexity of rotating an array of size 'n' by 'k' positions in place?
O(n*k)
O(k)
In which scenario would using Insertion Sort for sorting an array be advantageous?
Sorting an almost sorted array.
Sorting a very large array.
Sorting an array in reverse order.
Sorting an array with many duplicate elements.