ok heres my problem....
im reading in this file
{
[start]
Java is [X] fancy! ;
This [Y] ! ;
}
{
[X]
very ;
[X] very ;
}
{
[Y]
[Z] cool ;
rocks ;
}
{
[Z]
is really ;
could be ;
}
as you can see, there are 4 possible states ( [start], [X], [Y], [Z] )
i made a hash function where it adds up all the ascii values so..
[start] = 742
[X] = 272
[Y] = 273
[Z] = 274
mod each of those number by 4, because i am planning to put each in a different cell in an array....so now it looks like this after the mod....
[start] = 2
[X] = 0
[Y] = 1
[Z] = 2
as u can see, [start] and [Z] has the same number, so both will try and go into the same array cell... i think this is called a "collision". I cant figure out a way to resolve it... ive been looking at my book for a while and its unclear to me.... anyone know how to fix this problem? i will need to look up this values later in the program too.
im reading in this file
{
[start]
Java is [X] fancy! ;
This [Y] ! ;
}
{
[X]
very ;
[X] very ;
}
{
[Y]
[Z] cool ;
rocks ;
}
{
[Z]
is really ;
could be ;
}
as you can see, there are 4 possible states ( [start], [X], [Y], [Z] )
i made a hash function where it adds up all the ascii values so..
[start] = 742
[X] = 272
[Y] = 273
[Z] = 274
mod each of those number by 4, because i am planning to put each in a different cell in an array....so now it looks like this after the mod....
[start] = 2
[X] = 0
[Y] = 1
[Z] = 2
as u can see, [start] and [Z] has the same number, so both will try and go into the same array cell... i think this is called a "collision". I cant figure out a way to resolve it... ive been looking at my book for a while and its unclear to me.... anyone know how to fix this problem? i will need to look up this values later in the program too.