Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disk-based trie?

I'm trying to build a Trie but on a mobile phone which has very limited memory capacity.

I figured that it is probably best that the whole structure be stored on disk, and only loaded as necessary since I can tolerate a few disk reads. But, after a few attempts, it seems like this is a very complicated thing to do.

What are some ways to store a Trie on disk (i.e. only partially loaded) and keep the fast lookup property?
Is this even a good idea to begin with?

like image 846
chakrit Avatar asked Oct 01 '10 21:10

chakrit


People also ask

How is a trie stored in memory?

In its original form the trie [2] is a data structure where a set of strings from an alphabet containing m characters is stored in an m-ary tree and each string is represented by a unique path from the root to a leaf node.

Is there STL for trie?

Iterator: trie<T>::iterator Iterators are a very important part of STL. Trie project also has iterators to support the same.

Is trie memory efficient?

Trie, especially Patricia trie, is widely used in forwarding table implementation for its memory efficiency. Using this structure, searching for names that share the same prefix only needs to save one copy of the shared part. It also naturally supports both exact match and LPM.

What is a trie used for?

A Trie is a special data structure used to store strings that can be visualized like a graph. It consists of nodes and edges. Each node consists of at max 26 children and edges connect each parent node to its children.


2 Answers

The paper B-tries for disk-based string management answers your question.

It makes the observation:

To our knowledge, there has yet to be a proposal in literature for a trie-based data structure, such as the burst trie, the can reside efficiently on disk to support common string processing tasks.

like image 187
user497981 Avatar answered Sep 22 '22 17:09

user497981


I've only glanced at it briefly, but Shang's "Trie methods for text and spatial data on secondary storage" discusses paged trie representations, and might be a useful starting point.

like image 22
Matthew Slattery Avatar answered Sep 21 '22 17:09

Matthew Slattery