As a side note, if you have the possibility to sort data before searching values in it then implement trie: https://en.wikipedia.org/wiki/Trie This is the best for data with very few updates/modifications and a lot of queries. One example would be points of interest on a map, like restaurants on google maps. Not like those restaurants gets updated/modified every single day but you do have clients that while using you…
If you're already using Postgres, isn't that precisely what GiST indexes are meant for?
How fast does interpolation search converge?
21–27 of 27 posts
Re: How fast does interpolation search converge?
#22The problem spaces I normally deal with involve clumps of data, not really uniform except within each clump.
Re: How fast does interpolation search converge?
#23The problem I see is the assumption of a uniform distribution. The problem spaces I normally deal with involve clumps of data, not really uniform except within each clump.
Re: How fast does interpolation search converge?
#24One good thing about binary search is memory access pattern. The element in the middle of the array is tested every single time. Similarly, the elements at 25% and 75% of the array are tested very often, in 50% searches/each. Modern computers have very slow memory compared to computation speed, and multi-level caches to compensate. Binary search RAM access pattern, when done many times, is friendly towards these mult…
Re: How fast does interpolation search converge?
#25Re: How fast does interpolation search converge?
#26The problem I see is the assumption of a uniform distribution. The problem spaces I normally deal with involve clumps of data, not really uniform except within each clump.
is there something that's better than interpolation search and binary search, for that kind of data?
One thing I have done is a double binary search.
Store prefixes and suffixes seperately. A binary search of the prefixes identifies the suffix clump to search with a binary search. This involves a slight increase in storage --- each prefix needs a suffix pointer.
But maybe I will now try an interpolation search on the suffixes.
Re: How fast does interpolation search converge?
#27I think Microsoft uses with btrees: https://github.com/microsoft/ALEX Of course they call it "ML", but it's just a linear interpolation for faster tree search.