Way to store a large dictionary with low memory footprint + fast lookups (on Android)

前端 未结 7 969
醉话见心
醉话见心 2021-01-30 23:17

I\'m developing an android word game app that needs a large (~250,000 word dictionary) available. I need:

  • reasonably fast look ups e.g. constant time preferable, n
相关标签:
7条回答
  • 2021-01-31 00:02

    You'll be wanting some sort of trie. Perhaps a ternary search trie would be good I think. They give very fast look-up and low memory usage. This paper gives some more info about TSTs. It also talks about sorting so not all of it will apply. This article might be a little more applicable. As the article says, TSTs

    combine the time efficiency of digital tries with the space efficiency of binary search trees.

    As this table shows, the look-up times are very comparable to using a hash table.

    0 讨论(0)
提交回复
热议问题