A trie for keys "t", "to", "te", "tea", "ten", "i", "in", and "inn".
Find collectible rare stamps from all over the world - United States, Asian, Europe, Africa, Australia, Latin America, United Kingdom.

Structures, Machines

In computer science, a trie, or prefix tree, is an ordered tree data structure that is used to store an associative array where the keys are usually strings. more...

Home
Asia
Australia
Br. Comm. Other
Canada
Europe
Latin America
Middle East
Publications & Supplies
Topical & Specialty
Animation, Cartoons
Cinderellas & Fakes
Nature
Other
People, Sports
Structures, Machines
Transport, Space
World Errors, Freaks,...
UK (Great Britain)
United States
Worldwide

Unlike a binary search tree, no node in the tree stores the key associated with that node; instead, its position in the tree shows what key it is associated with. All the descendants of any one node have a common prefix of the string associated with that node, and the root is associated with the empty string. Values are normally not associated with every node, only with leaves and some inner nodes that happen to correspond to keys of interest.

The term trie comes from "retrieval." Due to this etymology it is pronounced ("tree"), although some encourage the use of ("try") or the use of ("tree-ay") in order to distinguish it from the more general tree.

In the example shown, keys are listed in the nodes and values below them. Each complete English word has an integer value associated with it. A trie can be seen as a deterministic finite automaton, although the symbol on each edge is often implicit in the order of the branches.

It is not necessary for keys to be explicitly stored in nodes. (In the figure, words are shown only to illustrate how the trie works.)

Though it is most common, tries need not be keyed by character strings. The same algorithms can easily be adapted to serve similar functions of ordered lists of any construct, e.g., permutations on a list of digits, permutations on a list of shapes, etc.

Advantages and drawbacks, relative to binary search tree

The following are the main advantages of tries over binary search trees (BSTs):

Looking up keys is faster. Looking up a key of length m takes worst case O(m) time. A BST takes O(log n) time, where n is the number of elements in the tree, because lookups depend on the depth of the tree, which is logarithmic in the number of keys if the tree is balanced. But in the worst case, both are as bad/good as O(log n), because log(n) will approach m in the worst case. Also, the simple operations tries use during lookup, such as array indexing using a character, are fast on real machines.; Tries can require less space when they contain a large number of short strings, because the keys are not stored explicitly and nodes are shared between keys with common initial subsequences.; Tries help with longest-prefix matching, where we wish to find the key sharing the longest possible prefix of characters all unique.;

Applications

As replacement of other data structures

As mentioned, a trie has a number of advantages over binary search trees (see Bentley & Sedgewick reference detailing a number of them). A trie can also be used to replace a hash table, over which it has the following advantages:

Read more at Wikipedia.org


[List your site here Free!]

214552 Guinea 1965. Buildings-Arts-Airplains $185.00 214553 Guinea 1967. Buildings-Fauna $185.00
143618 Belarus 2003. Architecture $99.00 Russia-1978-Mnh-Comm/Glob e/15K-100 Stamps-Cv$500(32) $44.99
Lighthouses - Beautiful Mint Sheet of 2 Mnh - Sv0134 $3.50 St Thomas - Lighthouses Mint Souvenir Sheet - St73D04 $6.00
Lighthouses On Stamps - Mint Sheet of 4 - St7312a $12.00 Sao Tome - Lighthouses & Shells 4 Mint Stamps St8108a $12.00
[W] 2000 Malaysia Population & Housing Census Imperf Fp $9.99 [W] 2000 Malaysia Millennium 2nd Series Imperf Uncut Fp $19.99
Sao Tome - World Bridges - 6 Mint Stamp Sheet St8120a $12.00 Hungary-1975-Mnh-Architec tural Heritage Yr-Strip/4(161) $62.50
Guinea-Bissau - Lighthouses Mint Souvenir Sheet Gb8111b $14.00 Egyptian Pyramids - Mint Sheet of 6 Stamps - Sv0082 $7.00
Afghanistan 1951 Withdrawn Stamps Buddha Bamiyan $9.95 San Marino : Sc.#671-675 Cathedrals Toledo Etc, Mnh $2.99
Russia 2008-13 Churches. Joint with Romania, Mnh $2.00 Russia 2008-13 Churches. Joint Romania. Mini-Sheet, Mnh $5.40
Russia 2008-12 Regions, Mnh $3.15 2008 Bridges of Malaysia 4 Uncut Stamp Sheets + Fdc $49.99
Europa/Andorra-1969-Mnh-C ept/Blocks-Set/2-Cv.$105(1 38) $35.00 Estonia 2008-03a Lighthouse. Mini-Sheet, Mnh $7.90
Latvia 2008-07 Lighthouse, Mnh $2.50 Kazakhstan 2008-05 Kazakh Post. Mini-Sheet, Mnh $4.70
Estonia 2008-15 My Stamp. Architecture, Mint $1.80 Lithuania 2008-01 Churches, Mint $2.90
Latvia – lighthouse, 2008 stamp - booklet - Mnh $9.94 Slogan Postmark Cover: Winchester Cathedral $1.50
Slogan Postmark Cover: Historic Churches Trust $1.40 Cape Don Lighthouse Maxi Card Australia - 2006 $4.00
2008 Philippines Colonial Bridges Ser Ii--B4+Ss on 2Fdc $2.95 Glable Postage Triangle Full Sheet Stamp Thailand 2005 $5.99
San Marino : Sc.#473-476 Gate Tower Church, Mnh $2.99 Point Cartwright Lighthouse Maxi Card Australia - 2006 $4.00
Uar 1967 Unesco Scouts & Winged Lion Mint Set $9.95 Paris Monuments On Stamps - Mint Sheet of 4 - Gb7310a $9.00
Lighthouses On Stamps - Mint Sheet of 9 - 6010 $4.00 Lighthouses - Mint Sheet of 6 - Mnh - 3711 $3.50
St Thomas - Castles - 4 Mint Stamp Sheet Mnh - St8203a $12.00 Guinea-Bissau - Lighthouses 4 Mint Stamp Sheet Gb8111a $9.00
Guinea-Bissau - Treaty of Rome Souvenir Sheet - Gb8101b $14.00 Cancer Human Skeleton Anti- Tobacco India Gandhi Error $34.99
Czecho : Sc.#1466 Montreal Expo City Skyline, Mnh S/S $2.99 India New Delhi Set Monuments Baha'i Bahai Temple Sheet $69.99
Malta : Sc.#371-374 History Of Architecture, Mnh $2.99 San Marino : Sc.#731-732 Rotary Prison Building, Mnh $2.99
San Marino : Sc.#633-638 Tower Bridge Palace, Mnh $2.99 San Marino : Sc.#491-493 Towers Neptune'S Fountain, Mnh $2.99
Scarce 1950 Algerie Maximum Card Arab Cemetery $9.99 Scarce 1949 Algerie Maximum Card Sidi Mosque $9.99
Scarce 1949 Algerie Maximum Card Djema Mosque Monument $9.99 Scarce 1948 Tunisia Maximum Card Al Halfaouina Mosque $9.99
Scarce Algerie Maximum Card Marabout Building $9.99 Rare 1936 Paraguay Maximum Panteon Building Zeppelin 2 $9.99
Rare 1936 Paraguay Maximum Panteon Building $9.99 Early 1934 Algerie Maximum Card Arab Street $9.99
Ukraine Stamps “Se-Tenant Bridges” 2004 $2.99 Indian Maximum Card St. Stephens College $4.52
Click to see more Structures, Machines items
Prices current as of last update, 07/03/08 2:43pm.


Home Contact Resources Exchange Links eBay