When you try to sign up on a platform like Instagram and type in your username, the system almost instantly tells you whether it’s available or not. If it’s taken, it even suggests alternatives on the spot.
Trie is usually stored in-memory while DB fetches from disk. That's why trie is usually faster. Also, trie works in O(m) where m is just the length of the string which is lot faster. Many relational databases O(log N) time for lookups after indexing, where N is the number of records.
Nice 👍
Nice one
Great post, seeing some things come up again and again.
Insightful.
When you talk about fast look ups with Trie, how does it take less time checking in DB?
If DB itself uses Trie data structure, then it makes sense.
If someone explains it here, it’ll be really helpful.
Trie is usually stored in-memory while DB fetches from disk. That's why trie is usually faster. Also, trie works in O(m) where m is just the length of the string which is lot faster. Many relational databases O(log N) time for lookups after indexing, where N is the number of records.