@atul: I dont think you should make this assumption entering "at" should list down all the phone numbers starting with "at". It should be rather taken as "at" can occur anywhere in the name (beginning, mid or end). This is how it works in Android(I have android based phone and I checked it personally).
In this case, Trie wont help. Instead suffix trees can be a good option. On Sat, Dec 24, 2011 at 11:21 AM, atul anand <[email protected]>wrote: > @dave : > > using only one hastable will cause problem , if 2 person have same name > ...right?? > > using 2 hashtable then:- > if say two person has same name , they will collide at same point on 2nd > hashtable. > so second hashtable must contain linked list implementation to contain > phone number of both...... right?? > > now if we care of finding contact number by taking input string(name of > the person ) then for this case Trie is a better option . but what will > happen if 2 person have same name?? > > i am more interested in knowing like in are mobile phone when i give input > as -> *at* then it gives me list of names which starts with alphabets *at* , > which can be possible if use data structure like Trie.but as i have > mentioned above , my only concern is what will happen if two person have > same name. > > i guess they use both Trie and hastable to achieve this. > > what is your take on this?? > > On Sat, Dec 24, 2011 at 8:09 PM, Dave <[email protected]> wrote: > >> @Atul007: Use a hash table. Enter the name and the number into the >> table, or use separate hash tables for names and numbers. The data >> associated with each is a pointer to the other. >> >> Dave >> >> On Dec 24, 1:50 am, atul007 <[email protected]> wrote: >> > If you want to instant search a contact number of person from a phone >> > book. >> > >> > one must be able to use any one of them to search(person name or >> > contact number). >> > >> > for eg : given phone number as input it should return name of the >> > person >> > >> > or >> > >> > given name of the person as input it should return phone number of the >> > person. >> > >> > we can use TRIE , but for that we have to maintain 2 different Trie >> > >> > or >> > >> > we can use hastable. >> > >> > which one you guys think will be good approach for this??? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> >> > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Regards, Piyush Kansal -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
