You are designing a system to store a large sparse matrix where memory usage is critical. Which approach is most suitable?
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.
Implement the sparse matrix using a hash table.
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
Linear Search
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.
Increase the array size by a fixed constant when full.
Create a new array with exactly the required size.
Which sorting algorithm has the least space complexity among Merge Sort, Quick Sort, and Heap Sort?
Heap Sort
Merge Sort
What data structure is commonly used to implement a sparse array efficiently?
Binary Tree
Linked List
Hash Table
Queue
What is the main challenge in implementing a circular array?
Managing the wrap-around behavior correctly
Determining the starting index of the array
Efficiently searching for elements in the array
Handling the resizing of the array
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 always has a time complexity of O(n log n).
It is a stable sorting algorithm.
It is generally preferred over Merge Sort for arrays.
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?
Standard array with shifting elements on each insertion
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
What is the primary data structure used in Heap Sort?
Binary Heap
Stack
What is the time complexity of deleting a given value from an unsorted array in the worst case?
O(log n)
O(1)
O(n log n)
O(n)