Data::Trie.3pm

Langue: en

Version: 2004-08-09 (mandriva - 01/05/08)

Section: 3 (Bibliothèques de fonctions)

NAME

Data::Trie - An implementation of a letter trie

SYNOPSIS

         use Data::Trie;
         $t = Data::Trie->new;
         $t->add('orange', 'kind of fruit');
         ($result, $data) = $t->lookup->('orange');
         $t->remove('orange');
         $t->getAll;
 
 

DESCRIPTION

This module implements a letter trie data structure. This is a linked set of nodes representing a set of words. Starting from the root, each letter of an included word is a daughter node of the trie. Hence, if a word is in the trie, there will be a path from root to leaf for that word. If a word is not in the trie, there will be no such path.

This structure allows for a relatively compact representation of a set of words. This particular implementation allows each word to be stored alone or with some associated data item.

Note that the "remove()" method does not prune nodes and thus a "Trie" can only grow in size.

COMPARE

This implementation differs from Tree::Trie in that "lookup()" checks for a match, rather than checking for whether the current string is a prefix.

VERSION

0.01

AUTHOR

Michael Hammond, hammond@u.arizona.edu