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?
10
1000
100
500
What is the time complexity of resizing a dynamic array (like ArrayList in Java or vector in C++) when it becomes full?
O(n)
O(1)
O(log n)
O(n log n)
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?
Circular array to efficiently manage the fixed-size buffer
Dynamic array (ArrayList, vector) to accommodate varying data sizes
Standard array with shifting elements on each insertion
Sparse array to handle potentially sparse data
Rotating an array by 'k' positions to the right means:
Reversing the entire array.
Sorting the array in descending order.
Shifting each element 'k' positions to the left.
Shifting each element 'k' positions to the right.
Which searching technique is most suitable for searching for a target element in a sorted array that is rotated at an unknown pivot point?
Binary Search
Depth First Search
Interpolation Search
Linear Search
What is the main challenge in implementing a circular array?
Managing the wrap-around behavior correctly
Handling the resizing of the array
Efficiently searching for elements in the array
Determining the starting index of the array
Which of the following is NOT a characteristic of a stable sorting algorithm?
Preserves the order of equal elements.
Always has a time complexity of O(n log n).
Suitable for sorting objects based on multiple criteria.
Can be implemented in both recursive and iterative forms.
You are designing a system to store a large sparse matrix where memory usage is critical. Which approach is most suitable?
Store the matrix in a text file and read it when needed.
Use a dynamic array and resize it as needed.
Use a standard 2D array.
Implement the sparse matrix using a hash table.
What is the time complexity of inserting an element into a Max Heap containing 'n' elements?
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