--

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.

--

--

Andrey Pechkurov
Andrey Pechkurov

Written by Andrey Pechkurov

Core database engineer at QuestDB. Distributed systems gazer. Node.js contributor. Occasional tech blogger and speaker.

No responses yet