Which of the following algorithms guarantees finding the target element in a sorted array if it exists?
Linear Search
Both Linear Search and Binary Search
Interpolation Search
Binary Search
Interpolation search is most likely to outperform binary search when:
The array size is small.
The array is uniformly distributed.
The array is unsorted.
The target element is located near the middle of the array.
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 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?
Quick Sort
Bubble Sort
Which of the following statements is TRUE about Quick Sort?
It is generally preferred over Merge Sort for arrays.
It performs poorly on already sorted arrays if the pivot selection is not optimized.
It is a stable sorting algorithm.
It always has a time complexity of O(n log n).
Which data structure is most suitable for implementing a sorted array with efficient insertion and deletion operations?
Stack
Queue
Linked List
Array
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 right.
Shifting each element 'k' positions to the left.
What is the primary data structure used in Heap Sort?
Binary Heap
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?
Increase the array size by a fixed constant when full.
Double the size of the array when full.
Create a new array with exactly the required size.
Use a linked list instead of resizing the 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 - 1
m * n - 1
m * n