Академический Документы
Профессиональный Документы
Культура Документы
Ans. Jump search does not require any additional space for searching the
required element. Thus its auxiliary space requirement will be O(1).
Ques.3.In which case the jump search will be preferred over binary
search?
Ans. Jump search only needs to jump backwards once, while a binary can jump
backwards up to log n times. Thus jump search will be preferred over binary
search if jumping backwards is expensive
Ques.4. What is the value of jump taken for maximum efficiency while
implementing jump search?
Ans. Total number of comparisons required will be n/k + k-1 in worst case. This
function will be minimum for k=n1/2. So this value of jump will be the best for
implementing jump search.
Ques.5. How many Jumps are made in the jump search algorithm?
Ans. In jump search algorithm jumps are made until element having value
greater than the value of element being searched is found. After this linear
search is performed in backwards direction.
Ans. It discards half of the values based on the comparison between the value
found at the estimated position and the value to be searched. But
in interpolation search, interpolation is used to find an item near
the one being searched for, and then linear search is used to find the exact
item.
Ans. The Big O is O(Z^n) where Z is the golden ratio or about 1.62. Both the
Leonardo numbers and the Fibonacci numbers approach this ratio as we
increase n. Unlike other Big O questions there is no variability in the input and
both the algorithm and implementation of the algorithm are clearly defined.
Ans. If the elements being searched have non-uniform access memory storage
(i. e., the time needed to access a storage location varies depending on the
location accessed), the Fibonacci search may have the advantage over
binary search in slightly reducing the average time needed to access a storage
location.
Ans. The n-th Fibonacci number is the sum of the (n-1)th and the (n-2)th. So
to calculate the 100th Fibonacci number, for instance, we need to compute all
the 99 values before it first - quite a task, even with a calculator!
Ans. Exponential search does not require any auxiliary space for finding the
element being searched. So it has a constant auxiliary space O(1)
Ques. 26. Best case of the exponential search will have time complexity of?
Ans. Best case of the exponential search will be when the first element of the
array is the element that is being searched. In this case, only one comparison
will be required. Thus it will have a time complexity of O(1).
Ques. 27. Which of the searching algorithm is used with exponential sort
after finding the appropriate range?
Ans. In exponential search, we first find a range where the required elements
should be present in the array. Then we apply binary search in this range.
Ans. In exponential search, we first find a range where the required elements
should be present in the array. Then we apply binary search in this range. This
takes O(log n) time in the worst case.