https://github.com/mtchavez/trie-rb
Fredkin trie algorithm in Ruby
https://github.com/mtchavez/trie-rb
Last synced: about 2 months ago
JSON representation
Fredkin trie algorithm in Ruby
- Host: GitHub
- URL: https://github.com/mtchavez/trie-rb
- Owner: mtchavez
- Created: 2013-04-15T17:05:13.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2013-04-15T17:39:36.000Z (about 12 years ago)
- Last Synced: 2025-02-04T15:32:38.273Z (4 months ago)
- Language: Ruby
- Size: 109 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
trie-rb
=======[](https://travis-ci.org/mtchavez/trie-rb)
Fredkin trie algorithm in Ruby
## Usage
Initialize a tree
```ruby
trie = Trie.new
p trie.tree
# {"root"=>{}}
```Insert some terms
```ruby
%w[to tea ten ted A in inn].each { |term| trie.insert(term) }
p trie.tree
# {"root"=>{"t"=>{"o"=>{}, "e"=>{"a"=>{}, "d"=>{}, "n"=>{}}}, "A"=>{}, "i"=>{"n"=>{"n"=>{}}}}}
```## Tests
Run tests using ```rake```
## License
Written by Chavez
Released under the MIT License: http://www.opensource.org/licenses/mit-license.php