Question

1- What are the requirements to be able to use a binary search? • On which...

1- What are the requirements to be able to use a binary search?
• On which data does the binary search work particularly well or particularly badly?
• What is the effort of binary search in the average case or worst case? with explanation please

2-What are the requirements to be able to use an interpolation search?
• On which data does the interpolation search work particularly well or particularly badly?
• What are the costs of interpolation search in the average case or worst case? with explanation please

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Binary Search

Work well with integer, double, float and char type of data but not work well with string type of data because string consist multiple characters so it requirement multiple matching within string so it take lot of time

Worst-case performance‎: ‎O(log n)

Best-case performance‎: ‎O(1)

Average performance‎: ‎O(log n)

interpolation search

same as above

Worst-case performance‎: ‎O(n)

Best-case performance‎: ‎ O (log log n))

Average performance‎: ‎ O (log log n))

Binary Search vs interpolation search

The Interpolation Search is an improvement over Binary Search for examples, where the qualities in an arranged cluster are uniformly distributed. Binary Search dependably goes to the center element to check. Then again, interpolation search may go to various areas as indicated by the estimation of the key being searched. For instance, if the estimation of the key is nearer to the last element, interpolation search is probably going to begin search close to the end side. Interpolation search works superior to Binary Search for an arranged and uniformly distributed cluster.

On average the interpolation search makes about log(log(n)) correlations (if the elements are uniformly distributed), where n is the quantity of elements to be searched. In the worst case (for example where the numerical estimations of the keys increment exponentially) it can make up to O(n) correlations.

Add a comment
Know the answer?
Add Answer to:
1- What are the requirements to be able to use a binary search? • On which...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT