Java Hash Table 2

Java Hash Tables 2Welcome to the 2nd part of my Java Hash Tables tutorial. If you missed part 1, definitely watch it first here Java Hash Table.

In this tutorial, I will cover all of the following and more: 1. Why We Use Prime sized hash tables 2. How to Increase Hash Table Size 3. How to Avoid Clustering 4. How Double Hashing Works 5. How to Find Values in a Double Hashed Hash Table

This video provides many useful algorithms aside from the info on hash tables.

If you like videos like this, it helps to tell Google+ with a click here [googleplusone]

Code From the Video

Java Hash Tables HashFunction2.java

2 thoughts on “Java Hash Table 2”

  1. Is possible another way of dealing with collisions is to make a 2D array ([x][y]) and instead of moving a value with a index up the array by [i++] you move the value using the same index [x] but inputting into an empty portion of the array in the [y] portion of the 2D array?

  2. Am I missing something in the functions doubleHashFunc() and findKeyDblHashed()? The stepDistance variable is calculated differently. In doubleHashFunc() you have it calculated as

    int stepDistance = 7 – (Integer.parseInt(key) % 7);

    and in findKeyDblHashed() you have it calculated as:

    int stepDistance = 5 – (Integer.parseInt(key) % 5);

    Was this just an overlooked mistake or should I be understanding something that I don’t seem to be?

    Thanks!

    Phil

Leave a Reply

Your email address will not be published. Required fields are marked *