Which of the following algorithms guarantees finding the target element in a sorted array if it exists?
Both Linear Search and Binary Search
Linear Search
Binary Search
Interpolation Search
You want to search for a target value in a sorted array with millions of elements. Which algorithm would generally be the fastest?
Jump Search
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.
Implement the sparse matrix using a hash table.
Use a dynamic array and resize it as needed.
Use a standard 2D array.
Which searching technique is most suitable for searching for a target element in a sorted array that is rotated at an unknown pivot point?
Depth First Search
What is the time complexity of searching for a target value in a sorted array using binary search?
O(1)
O(n)
O(n log n)
O(log n)
What is a key characteristic of a circular array?
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.
It allows direct access to any element in O(1) time.
Quick Sort is generally considered faster than Merge Sort in practice. What is one of the main reasons for this?
Quick Sort has better space complexity than Merge Sort.
Quick Sort has better time complexity in all cases.
Quick Sort typically has smaller constant factors in its time complexity.
Quick Sort is a stable sorting algorithm, while Merge Sort is not.
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 - 1
m * n - 1
m + n
Which sorting algorithm would be most suitable for sorting a very large dataset that cannot fit entirely in RAM?
Heap Sort
Quick Sort
Merge Sort
Which sorting algorithm has the least space complexity among Merge Sort, Quick Sort, and Heap Sort?