MosesA
MosesA

Reputation: 965

Best Data Structure for strings

I want a make an app for a Bible. But I'm wondering how to store the data so searching will be fast. I'm think of 2D arrays but that seems tasking and slow.

Thanks.

Upvotes: 0

Views: 1395

Answers (1)

Bryan Glazer
Bryan Glazer

Reputation: 852

You can use a Map<String, String> as Reimeus suggested.

You could also try a trie. This is a data structure allows predictive searching. That is, you type in part of a word and it can predict how you might finish the word.

A DAWG would probably be a better option for something as large as the Bible, but its a bit more complex than a trie.

Upvotes: 2

Related Questions