0

I have planned to use trie data structure implementation in dictionary application, but the problem is loading more than 10,000 words into the trie. Though trie takes out redundancy of letters and total memory loaded in primay would nothing more than couple of kbs but still the time required for loading all the words into the trie would take a lot of time nwould take even more if it's implemented for a mobile phone app..

Any suggestions of what could be done?

5
  • How long does it actually take? Commented Mar 20, 2013 at 7:43
  • i have not tested but it should take a long time.. more than 80k words are there in the database I have. Should take a considerable amount of time or the mobile may force quit the app.. :/ Commented Mar 20, 2013 at 8:23
  • 1
    80K is not that much, I would suggest you test it before coming to conclusions, you may be surprised. Also, what mobile phone are you targetting? Depending on your needs, if you need nothing more than just checking if a word is in the dictionary, a hash table will do the job and will be loaded faster. This is JavaScript but the concepts apply: ejohn.org/blog/javascript-trie-performance-analysis Commented Mar 20, 2013 at 8:43
  • Check this too: ejohn.org/blog/revised-javascript-dictionary-search Commented Mar 20, 2013 at 8:50
  • Thanks @pin.. interesting article .. :) Let me implement it and will be back with the results i got . :) Commented Mar 20, 2013 at 11:09

1 Answer 1

1

Instead of (or maybe in addition to) shipping a database containing a dictionary along with your app, you could ship a serialized trie containing all the dictionary words. This could be serialized in any way you want (perhaps as a blob in a database or xml file) and you could then deserialize it to create a java trie object when the app starts up.

To do this you could use a deploy script which creates the trie by going through all dicitionary words, places them into the trie and then serializes the trie into some file or blob and packages this serialized trie with the released app.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.