Skip to content

Hash Function Testing #61

@alexespejo

Description

@alexespejo

Test linear, quadratic, and double hashing.

Inside of linearProbing.test.ts quadraticProbing.test.ts doubleHashing.test.ts create new tests to account for the new f(k) function.

Updates

Now all function takes 3 extra prameters fType, a, b, c

  • fType (string) containing either "k", "%", or "+"
    • k -> f(k) = k
    • % -> f(k) = k % c
    • + -> f(k) = a * k + b
  • a, b, and c are all integers associated with the above computations
    • Whether a, b, or c is used is dependent on the value of fType . If fType = + then the value of c doesn't matter.

Tests

Focus on testing for when the collisions occur so pick numbers that you know will for sure collide to ensure that the probing methods work as expected.

For accuracy use a calculator to ensure that the collisions are appropriately resolved.

  1. 3 tests for each type of f(k) (i.e k, %, +) maps to the same index several times (9 tests)
  2. 2 tests for each f(k) using linear probing, with a given stepsize (2 tests)
  3. 3 tests for each f(k) where the capacity is not 10 (~9 tests you can apply this test to the nine from number 1)
  4. at least 3 of your own tests that use some arbitary combination of values for each f(k) (~9 tests)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions