@Swathi :We can't use trie data structure to store the phone numbers.
The most sound reason is that the users require phone numbers to be
sorted by name, but by using the trie data structure we can't get the
phone numbers which are sorted by name. Again we can't use trie whose
nodes are numbers, because phone numbers are searched by name always.
Nobody searches for a name, given a number. And if we use names as the
node in the trie, we end up using a lot of space because of pointers.

Worst case time complexity of search using trie -----   O(n)
Worst case time complexity of search using fixed array with circular
indexing ----  O(log n) because we can use binary search, and search
is most frequent query in a list of phone numbers.

I hope u got the idea. Another point is that we have very limited
memory in a phone, so we have too use fixed array.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to