Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

500,000 street names - what data structure and to use to implement a fast search?

So we have many street names. They come in a file. Id probably cache them when booting the server up in production. The search should be auto complete like - e.g. you type 'lang ' and you would get maybe 8 hits : langstr, langestr. Etc

like image 484
Toskan Avatar asked Aug 28 '12 00:08

Toskan


People also ask

Which data structure is used for fastest search?

In computer science, a search data structure is any data structure that allows the efficient retrieval of specific items from a set of items, such as a specific record from a database. The simplest, most general, and least efficient search structure is merely an unordered sequential list of all the items.

Which data structure is best for storing large data?

To store huge data donot use arrays where implementation is easy but insertion and deletion is very difficult. Hence use dynamic like linked list where insertion and deletion is easy.

What is data structures in Java?

Data structures in Java are a group of data elements through which data are stored and organized in the computer so they can be used more efficiently.


1 Answers

What you are looking for is some sort of compressed trie representation. You might want to look into succinct tries or DAWGs as a starting point, as they give excellent efficiency and very good space usage.

Hope this helps!

like image 199
templatetypedef Avatar answered Oct 23 '22 12:10

templatetypedef