What is the time complexity of rotating an array of size 'n' by 'k' positions in place?
O(k)
O(n*k)
O(1)
O(n)
In which scenario would using Insertion Sort for sorting an array be advantageous?
Sorting an array in reverse order.
Sorting an almost sorted array.
Sorting a very large array.
Sorting an array with many duplicate elements.
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
Binary Search on each row
Linear Search
Breadth First Search
Which sorting algorithm would be most suitable for sorting a very large dataset that cannot fit entirely in RAM?
Merge Sort
Heap Sort
Quick Sort
A dynamic array is used to store a growing dataset. When the array reaches its capacity and needs to resize, what is the common strategy to ensure amortized constant time complexity for appending elements?
Double the size of the array when full.
Use a linked list instead of resizing the array.
Create a new array with exactly the required size.
Increase the array size by a fixed constant when full.
You need to rotate an array by a very large 'k'. What optimization can be applied to improve efficiency?
Use a temporary array to store elements.
Sort the array before rotation.
No optimization is possible for large 'k'.
Calculate the effective rotation (k % n) where n is the array length.
What is the time complexity of searching for a target value in a sorted array using binary search?
O(log n)
O(n log n)
Which of the following statements is TRUE about Quick Sort?
It is a stable sorting algorithm.
It performs poorly on already sorted arrays if the pivot selection is not optimized.
It is generally preferred over Merge Sort for arrays.
It always has a time complexity of O(n log n).
Which of the following algorithms guarantees finding the target element in a sorted array if it exists?
Binary Search
Interpolation Search
Both Linear Search and Binary Search
Which sorting algorithm has the least space complexity among Merge Sort, Quick Sort, and Heap Sort?