### and

I will have to do some research to give you a good example of the hash table portion, but assuming mod means the modulus operator then mode71 is not much different than mod 10. The modulo operator returns the remainder after a division so taking the first number for example, 4371 mod 10 would be 1 (4371/10 = 431 r. 1) and 4371 mod 7 would be 3 (4371/7 = 624 r 3)
I figured it out. Here are the values that I got for both mod 10 and mod 7.

mod 10: 4371->1, 1323 ->3, 6173->3, 4199->9, 9679->9, 1989->9
mod 7: 3,0,6,6,5,1
Looks good. As for drawing out the hash tables that will depend on which collision method you are using. Linear probing and chaining are the most common. I believe that chaining is the common method that is taught at universities (it was at mine). which looks something like this.

using mod 10 on 4320, 4350, and 4351

0[]-->[4320]-->[4350]
1[]-->[4351]
2[]
3[]
4[]
5[]
6[]
7[]
8[]
9[]

Essentially you used a pointer to the next value if they map to the same one.

Once you know which collision method you use, you can draw the table.
Sorry the values for the h(x) = 7-(x mod 7) are : 4,7, 1,1 2, 6
how does rehashing works???
Here is what I have:

x mod 10:
0
1 ->[ 4371]
2
3 ->[1323] ->[6173]
4
5
6
7
8
9 ->[4199] ->[9679] ->[1989]

7-(x mod 7):
0
1->[4199] -> [6173]
2->[9679]
3
4->[4371]
5
6 ->[1989]
7->[1323]
8
9

Is this how I'm suppose do?
How do I apply the rehashing for 7-(x mod 7)?
Last edited on
Topic archived. No new replies allowed.