-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
complexity for searching #4
Comments
Surely you are not wrong. The intention of O(1) statement is to claim that it's not dependent on the database size, just like how hash table does similarly on non-colliding cases, despite the fact that it still takes O(m) on hash function evaluation. Anyway, I agree to add some more precision to the description. Let me revise it like this: Before:
After:
|
Thanks a lot for the clarification! |
The Readme suggests that this algorithm has a O(1) time complexity for searching.
However, every other source I read so far about time complexity of tries claims that the complexity is O(M) for searching where M is the maximum length of all inserted words. Which also does make more sense to me intuitively because in my imagination, the algorithm works like this: for every letter in the prefix I enter, the algorithm takes the corresponding path in the tree. This means it has to follow at least the number of letters in my prefix and at most M edges.
Can you explain to me where (or if) I'm wrong here?
The text was updated successfully, but these errors were encountered: