Navigation Menu

Skip to content

ultrasaurus/trie_example

Repository files navigation

Trie Example

This is a dictionary implemented as a trie, inspired by Tyler McMullen's LA RubyConf 2010 talk: http://www.scribd.com/doc/27149829/Alternative-Data-Structures-in-Ruby

There are also naive implementations using Array and Set that are fun for comparing performance and memory footprint.

How to use it:

>> require 'trie_dictionary'
=> true
>> d = Dictionary.new
=> #
>> d.add ("fish")
(irb):7: warning: don't put space before argument parentheses
=> true
>> d.add("fiend")
=> true
>> d.add("foo")
=> true
>> d.find('f')
=> ["fish", "fiend", "foo"]
>> d.find('fi')
=> ["fish", "fiend"]
>> d.find('fo')
=> ["foo"]

Alternate implementation Performance results:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published