In which scenario would using Insertion Sort for sorting an array be advantageous?
Sorting an array in reverse order.
Sorting an array with many duplicate elements.
Sorting a very large array.
Sorting an almost sorted array.
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 time complexity of inserting an element into a Max Heap containing 'n' elements?
O(1)
O(log n)
O(n)
O(n log n)
You are designing a system to store a large sparse matrix where memory usage is critical. Which approach is most suitable?
Implement the sparse matrix using a hash table.
Use a standard 2D array.
Store the matrix in a text file and read it when needed.
Use a dynamic array and resize it as needed.
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?
Linear Search
Binary Search on each row
Breadth First Search
Staircase Search
What is the primary data structure used in Heap Sort?
Binary Heap
Stack
Queue
Linked List
Which of the following is NOT a valid approach for array rotation?
Juggling Algorithm
Reversal Algorithm
Block Swap Algorithm
Merge Sort Algorithm
Quick Sort is generally considered faster than Merge Sort in practice. What is one of the main reasons for this?
Quick Sort is a stable sorting algorithm, while Merge Sort is not.
Quick Sort typically has smaller constant factors in its time complexity.
Quick Sort has better time complexity in all cases.
Quick Sort has better space complexity than Merge Sort.
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?
100
500
1000
10
In which scenario is a sparse array particularly useful?
Representing a matrix with mostly zero values
Storing a small array with frequent updates
Storing a large sorted array
Implementing a stack data structure