Hello,

The process is the following:

  1. Calculate hash code: in this simplified example we assume that it’s 2.
  2. Calculate bucket index based on the index: it’s 2%2 = 0.
  3. Lookup the head index in hashTable: 0 in this case.
  4. Iterate over the linked list stored in dataTable starting with index 0until the key is found: we’re going to start with <0, ‘a’> item (index 0) and then iterate to <2, ‘c’>(index 2).
  5. Return the key, if found, or undefined otherwise.

Hopefully, this makes sense.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store