require_relative 'array_list'

class MyHash
  attr_reader :array
  def initialize
    @array = ArrayList.new(5)
  end

  def set(key, value)
    index = hashing_function(key)
    @array.set(index, value)
  end

  def get(key)
    index = hashing_function(key)
    @array.get(index)
  end

  def remove(key)
    index = hashing_function(key)
    @array.set(index, nil)
  end

  def has_key?(key)
    index = hashing_function(key)
    if @array.get(index)
      true
    else
      false
    end
  end

  def hashing_function(string)
    string[0].ord
  end

  def size
    array.size
  end

end
require_relative 'array_list'

class MyHash
  attr_reader :array
  def initialize
    @array = ArrayList.new(100)
  end

  def set(key, value)
    index = hashing_function(key)
    @array.set(index, value)
  end

  def get(key)
    index = hashing_function(key)
    @array.get(index)
  end

  def remove(key)
    index = hashing_function(key)
    @array.set(index, nil)
  end

  def has_key?(key)
    index = hashing_function(key)
    if @array.get(index)
      true
    else
      false
    end
  end

  def hashing_function(string)
    string[0].ord
  end

  def size
    array.size
  end

end
Increase the initial size of MyHash
Increase the initial size of MyHash

This is necessary because the initial size is not large enough to prevent scenarios where someone is attempting to access the value of a certain key that doesn't actually exist yet. Without this fix, MyHash would raise an exception.
