Вы находитесь на странице: 1из 5

PI Questions

Ques.1. what is meant by Jump search?


Ans. Like Binary Search, Jump Search is a searching algorithm for sorted
arrays. The basic idea is to check fewer elements (than linear search) by
jumping ahead by fixed steps or skipping some elements in place of searching
all elements.

Ques.2. what is the auxiliary space requirement of the jump search?

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.

Ques.6. What is interpolation search technique?

Ans. An Interpolation Search is a type of searching algorithm.


An Interpolation Search is an improvement over Binary Search for scenarios
where the values in a sorted array are uniformly distributed. Binary Search goes
to the middle element to check.

Ques.7. What is the formula of interpolation?


Ans. The interpolation formula can be used to find the missing value.
However, by drawing a straight line through two points on a curve, the value at
other points on the curve can be approximated. In
the formula for interpolation, x-sub1 and y-sub1 represent the first set of data
points of the values observed.

Ques. 8. What is the complexity of interpolation search?

Ans. Linear Search finds the element in O(n) time, Jump Search takes O(√ n)


time and Binary Search take O(Log n) time. The Interpolation Search is an
improvement over Binary Search for instances, where the values in a sorted
array are uniformly distributed.

Ques.9. Why would you prefer an interpolation search to a binary search?

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.

Ques.10. Is interpolation search better than binary search?

Ans. Interpolation search works better than Binary Search for a sorted and


uniformly distributed array. On average the interpolation search makes about
log(log(n)) comparisons (if the elements are uniformly distributed), where n is
the number of elements to be searched.

Ques. 11. What is the purpose of interpolation?

Ans. Interpolation is the process of deriving a simple function from a set of


discrete data points so that the function passes through all the given data points
(i.e. reproduces the data points exactly) and can be used to estimate data points
in-between the given ones.

Ques.12. What is interpolation example?

Ans. Interpolation is the process of estimating unknown values that fall


between known values. In this example, a straight line passes through two
points of known value. ... The interpolated value of the middle point could be
9.5.

Ques.13. Where is interpolation used?


Ans. Interpolation is a way to find values between a pair of data points.
The interpolation formula can be used to find the missing value. However, by
drawing a straight line through two points on a curve, the value at other points
on the curve can be approximated.

Ques.14. What is the time complexity of Fibonacci search?

Ans. Fibonacci search has an average- and worst-case complexity of O(log n)


(see Big O notation). The Fibonacci sequence has the property that a number is
the sum of its two predecessors. Therefore the sequence can be computed by
repeated addition.

Ques.15. Which algorithm technique does Fibonacci search use?

Ans. Fibonacci Search. Fibonacci search technique is


a method of searching a sorted array using a divide and
conquer algorithm that narrows down possible locations with the aid
of Fibonacci numbers.

Ques.16. What is the big O of Fibonacci?

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.

Ques. 17. Is Fibonacci exponential?

Ans. The Fibonacci sequence itself isn't an exponential curve because it's only


defined over the integers. However, there are extensions which are defined over
the reals.

Ques.18. What are the advantages of Fibonacci search?

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.

Ques.19. What is the complexity of recursion?


Ans. To conclude, space complexity of recursive algorithm is proportinal to
maximum depth of recursion tree generated. If each function call
of recursive algorithm takes O(m) space and if the maximum depth
of recursion tree is 'n' then space complexity of recursive algorithm would be
O(nm).

Ques. 20. Is the Fibonacci sequence an algorithm?

Ans. The Fibonacci numbers are a sequence of integers in which


every number after the first two, 0 and 1, is the sum of the two
preceding numbers. These numbers are well known and algorithms to
compute them are so easy that they are often used in
introductory algorithms courses.

Ques. 21. What is the nth Fibonacci number?

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!

Ques. 22. What is exponential growth rate?

Ans. Exponential growth is a specific way that a quantity may increase over


time. It occurs when the instantaneous rate of change (that is, the derivative) of
a quantity with respect to time is proportional to the quantity itself.

Ques.23. What is an example of exponential decay?

Ans. Examples of exponential decay are radioactive decay and population


decrease. ... The half-life of a given substance is the time required for half of
that substance to decay or disintegrate.

Ques. 24. What is the auxiliary space requirement of an exponential sort


when used with iterative binary search?

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. 25. Is exponential searching algorithm is fastest?


Ans. Exponential search has the least time complexity (equal to log n) out of the
given searching algorithms. This makes exponential search preferable in most
cases.

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.

Ques. 28. What is the time complexity of exponential sort?

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.

Вам также может понравиться