Skip to content

About

Is there a better way to learn about data structures than by implementing them? Because that's my goal with this repo.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

 

History

44 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Data Structures in Ruby Build Status

Tech Inventory

  • Ruby
  • Rspec

Description

The purpose of this repository is for me to gain familiarity with common data structures by TDDing my way through straightforward Ruby implementations. I can't think of a better way to do that than by implementing them myself.

Completed so far

Trie

Tries are used to provide fast autocompletion. Over the list of words present in my local /usr/share/dict/words, it appears that autocomplete with a trie is over 700x faster than simply looking through an array of words for matches.

$ ruby benchmarks/trie_benchmark.rb
Calculating -------------------------------------
           With trie       403 i/100ms
With direct comparison
                             1 i/100ms
-------------------------------------------------
           With trie     8086.4 (±33.9%) i/s -      43121 in  10.015687s
With direct comparison
                           11.1 (±44.9%) i/s -         65 in  10.083059s

Comparison:
           With trie:     8086.4 i/s
With direct comparison:       11.1 i/s - 726.95x slower

About

Is there a better way to learn about data structures than by implementing them? Because that's my goal with this repo.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages