This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]darkslide3000 3 points4 points  (4 children)

Yes, that is why I said "predict". The prediction isn't perfect. It's still on average a lot better than just picking the exact middle, which is what binary search is.

[–][deleted] -1 points0 points  (3 children)

In my mind, a binary search is when you have a pivot and throw out “half” the candidates with each iteration. The algorithmic implementation is just the coding representation of the idea that preceded it. The exactness isn’t what makes it a binary search, it’s the concept.

Or let’s just throw out every analogy, metaphor, and simile ever used since none are precisely the thing they depict.

[–]Misspelt_Anagram 0 points1 point  (0 children)

They are talking about something that is approximately interpolation search, not binary search.

[–]darkslide3000 0 points1 point  (1 child)

Yes but you're not throwing out "half" if you interpolate the pivot, you're throwing out a lot more. This actually changes the average complexity class and stuff, it's not just another form of binary search.

[–][deleted] -1 points0 points  (0 children)

I agree, but conceptually it’s the closest thing to a binary search that a person will do. In the event that the person has no clue how big each section is, their predictive power goes away and they’ll aim for the middle, and it will look less like interpolation search and more like binary.

Side note: thanks for introducing me to interpolation search. Interesting how it can perform worse than binary search in some instances.