in reply to Re^3: Rapid text searches ( O(log n) time)
in thread Rapid text searches
The headline claim for O(1) time is based on comparison with Perl's hashes which also do a linear search down a bucket chain to resolve hash clashes, but are generally rated as O(1).That is because it's expected that the chains are short, and independent on the number of keys in the hash.
But your claim basically means that any sorted datastructure that doesn't have duplicates could, after linear processing to line up the elements, be searched in O(1) time. Your algorithm only achieves O(1) search time if the data is pretty uniformly spread between its extremes. But that's an exceptional case.
|
|---|