Rotating an array by 'k' positions to the right means:
Shifting each element 'k' positions to the right.
Sorting the array in descending order.
Shifting each element 'k' positions to the left.
Reversing the entire array.
You need to implement a buffer that stores a fixed number of recent data points, discarding older data as new data arrives. Which array-based structure would be most appropriate?
Dynamic array (ArrayList, vector) to accommodate varying data sizes
Circular array to efficiently manage the fixed-size buffer
Sparse array to handle potentially sparse data
Standard array with shifting elements on each insertion
What is the time complexity of inserting an element into a Max Heap containing 'n' elements?
O(1)
O(log n)
O(n)
O(n log n)
Merge Sort is considered a stable sorting algorithm. What does 'stable' mean in this context?
The algorithm is not affected by the initial order of elements in the array.
The algorithm always takes the same amount of time to sort an array of a given size.
The algorithm maintains the relative order of elements with equal values after sorting.
The algorithm uses a fixed amount of memory regardless of the input size.
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 a key characteristic of a circular array?
It allows direct access to any element in O(1) time.
It automatically sorts elements in ascending order.
It conceptually wraps around, so the last element is followed by the first.
It has a fixed size that cannot be changed.
In which scenario is a sparse array particularly useful?
Storing a large sorted array
Storing a small array with frequent updates
Implementing a stack data structure
Representing a matrix with mostly zero values
In which scenario would using Insertion Sort for sorting an array be advantageous?
Sorting an almost sorted array.
Sorting an array in reverse order.
Sorting a very large array.
Sorting an array with many duplicate elements.
Which of the following statements is TRUE about Quick Sort?
It performs poorly on already sorted arrays if the pivot selection is not optimized.
It is generally preferred over Merge Sort for arrays.
It is a stable sorting algorithm.
It always has a time complexity of O(n log n).
Which sorting algorithm would be most suitable for sorting a very large dataset that cannot fit entirely in RAM?
Heap Sort
Merge Sort
Quick Sort