Skip to content

Instantly share code, notes, and snippets.

@hcgatewood
hcgatewood / hash_table.rb
Last active December 23, 2019 08:23
An associative array in Ruby
#!/usr/bin/env ruby
# A simple hash table implementation in Ruby using Ruby's built-in
# prehashing methods, chaining, and variable load factors.
#
# Author:: Hunter Gatewood
# A linked-list node with key, value, and next node attributes.
class Node
attr_accessor(:key, :val, :next_node)