1

We are building a Phone book (Contacts) application and i have just googled on the net and found a useful data structure to use for the phone book application which is TRIE.

Could you please guide/suggest links such that we can implement a Phone book application using Trie data Structure.

Im a new bie to Data Structure and Algorithms in Java,Please consider this as my request to help me out.

Im unable to proceed as to whether it is really possible to implement it using TRIE data Structure or not?

Deepak
  • 2,094
  • 8
  • 35
  • 48
  • It seems like you're trying to make the solution (the Trie datastructure) fit some nebulous problem. Define the precise problem and then see what solutions make sense. – GaryF Dec 11 '10 at 16:32
  • -1: It seems the guy is looking just for the code. Check out his discussion with Goran Jovic in one of the answers below. – user183037 Feb 22 '11 at 16:58

2 Answers2

1

You should have your address book in any format needed, and use Trie to index it for search only.

See Trie data structures - Java

and Trie implementation

for some Java implementations.

EDIT:

and this: http://www.codeproject.com/KB/recipes/PhoneDirectory.aspx

Community
  • 1
  • 1
Goran Jovic
  • 9,418
  • 3
  • 43
  • 75
  • @Goran,Thank you for ur concern,any links you can suggest which can be helpful to implement this since i have to do it from sratch development in java – Deepak Dec 11 '10 at 14:54
  • @Deepak: I suppose you already have your address book implemented. So, all you need is a trie, where each node references your addres book entries somehow (by id, pointing to an object.. that depends on your implementation) – Goran Jovic Dec 11 '10 at 15:00
  • @Goran,Thanks for your concern,In case you find the real implementation for contact based application.,Please share the link – Deepak Dec 11 '10 at 15:02
  • @Deepak: NP, if I run into it, I'll remember to do so. Meanwhile, try googling for it. You already have the keywords. – Goran Jovic Dec 11 '10 at 15:34
  • @Goran,I know its bad to ask for answers on this forum,but its difficult to implement a phone based (contacts) application with searchByName and SearchByNumber facility using Trie data Structure,Anyone who has already implemented it.Please share your Advice/Suggestions/Link/Code – Deepak Dec 12 '10 at 09:32
  • @Goran,Its in c#,do you have the implementation in Java for Trie and Phone directory. – Deepak Dec 13 '10 at 13:27
  • @GoranJovic Yes, phone book can be modeled using a trie as you have mentioned. But I have a question here. TRIES are generally fed the key-data,so in this case, lets assume the name of the persons. So, obviously we need an extra mapping of the person names with the person phone numbers. So, what kind of datastructure should one be using? I mean one possible option is to go ahead with the hashtable approach. With that, we can identify the phone number of the person. But isnt having hashtable and trie at teh same time an overkill? Im very curious. Please suggest. Thanks, – Pavan Dittakavi Jun 10 '12 at 18:07
1

Checkout a previous question here on stackoverflow: Where do I find a standard Trie based map implementation in Java?

There are a few links in there that might help you out. Other useful links might be the following: http://wikipedia-clustering.speedblue.org/trieJava.php or http://www.technicalypto.com/2010/04/trie-in-java.html

Community
  • 1
  • 1
Tim
  • 831
  • 7
  • 7
  • Btw, also check out the 'related' questions at the right of this page. They might very well help you out too. – Tim Dec 11 '10 at 15:06