Rabin Karp algorithm and naive pattern searching algorithm have the same worst case time complexity.
True
False
30 practice sets · Page 1 of 2
Rabin Karp algorithm and naive pattern searching algorithm have the same worst case time complexity.
True
False
The naive pattern searching algorithm is an in place algorithm.
True
False
What is the auxiliary space complexity of Z algorithm for pattern searching (m = length of text, n = length of pattern)?
O(n + m)
O(m)
O(n)
O(m * n)
What is the time complexity of Z algorithm for pattern searching (m = length of text, n = length of pattern)?
O(n + m)
O(m)
O(n)
O(m * n)
What is the worst case time complexity of KMP algorithm for pattern searching (m = length of text, n = length of pattern)?
O(n)
O(n*m)
O(m)
O(log n)
What are the updated values of high and low in the array if the element being searched is lower than the value at calculated index in interpolation search (pos = current position)
low = pos + 1, high remains unchanged
high = pos - 1, low remains unchanged
low = low +1, high = high - 1
low = pos +1, high = pos - 1
What are the updated values of high and low in the array if the element being searched is greater than the value at calculated index in interpolation search (pos = current position)
low = pos + 1, high remains unchanged
high = pos - 1, low remains unchanged
low = low +1, high = high - 1
low = pos +1, high = pos - 1
What is the formula used for calculating the position in interpolation search (x = element being searched, A[] = input array, low and high are the leftmost and rightmost index of A[] respectively)
((x - A[low]) * (high - low)) / (A[high] - A[low])
high + ((x - A[low]) * (high - low)) / (A[high] - A[low])
low + ((x - A[low]) * (high - low)) / (A[high] - A[low])
x + ((x - A[low]) * (high - low)) / (A[high] - A[low])
Interpolation search has a better time complexity than exponential search for any given array.
True
False
Interpolation search is an in place algorithm.
True
False
Which of the following searching algorithm is fastest when the input array is not sorted but has uniformly distributed values?
jump search
linear search
binary search
interpolation search
Which of the following searching algorithm is fastest when the input array is sorted but has non uniformly distributed values?
jump search
linear search
binary search
interpolation search
Which of the following searching algorithm is fastest when the input array is sorted and has uniformly distributed values?
jump search
exponential search
binary search
interpolation search
What is the time complexity of exponential search when the input array is sorted but the values are not uniformly distributed?
O(n^{1/2})
O(log log n)
O(n)
O(log n)
What is the auxiliary space requirement of interpolation search?
O(n)
O(2^{n})
O(1)
O(log n)
What is the time complexity of interpolation search when the input array has uniformly distributed values and is sorted?
O(n)
O(log log n)
O(n log n)
O(log n)
In which of the following case jump search performs better than interpolation search?
When array has uniformly distributed values but is not sorted
when array is sorted and has uniform distribution of values
when array is sorted but the values increases exponentially
when array is not sorted
Interpolation search performs better than binary search when?
array has uniformly distributed values but is not sorted
array is sorted and has uniform distribution of values
array is sorted but the values are not uniformly distributed
array is not sorted
Interpolation search is a variation of?
Linear search
Binary search
Jump search
Exponential search
Which of the following is the most desirable condition for interpolation search?
array should be sorted
array should not be sorted but the values should be uniformly distributed
array should have a less than 64 elements
array should be sorted and the values should be uniformly distributed