Git Product home page Git Product logo

mymap's Introduction

#Comp 124 - MyMap Lab Instructions

In this lab, you'll be completing a simple hashtable implementation. Before you start, make sure you understand the types of the instance variables in the map:

  1. A single key / value pair is stored in a MyEntry object. MyEntry is a generic type with type parameters for the key and the value: MyEntry<K, V>.
  2. A single hash bucket is a list of MyEntry objects: List<MyEntry<K, V>>
  3. The type for the array of hash buckets is a simple extension of the previous data structure: List<MyEntry<K, V>> []

You should complete this lab in three parts:

  1. Complete the put() method:
    • Hint: the key may already exist!
    • Hint: every Java Object has a hashCode() and equals() method.
    • After you complete the put() method, the first unit test in TestMyMap should pass.
  2. Complete the get() method. The first two unit tests in TestMyMap should pass.
  3. Complete the expandIfNecessary() method.
    • This method should decide whether or not to double the size of the array based on the loadFactor.
    • If the size is doubled, all the entries have to be put into their new spots, or "rehashed."
    • All three unit tests should now pass.

mymap's People

Contributors

shilad avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.