Discussion:
Lab 4 question
(too old to reply)
Kyle Phillips
2005-11-16 02:19:17 UTC
Permalink
I've got my define to work, and I can display the conents of my partial
map. My undefine crashes with the violated assertion that the d_item i'm
looking for is not defined in that queue. This makes me think that my
"bucket number" is wrong. I debugged the bucket number and it seemed to
be zero no matter what i was defining. Here is the code i used:

object Integer bucket_number;
bucket_number = D_Item_Hash::Hash(d) mod hash_table_size;

Is there something wrong with this?

Thanks,

Kyle Phillips
Wayne D. Heym
2005-11-16 14:51:03 UTC
Permalink
Post by Kyle Phillips
object Integer bucket_number;
bucket_number = D_Item_Hash::Hash(d) mod hash_table_size;
Is there something wrong with this?
Not that I can see. You should also You should also "debug" d to see
its value. (I assume you're saying that in the *Define* operation the
bucket_number is zero.) In the Define operation, are you calling Hash
*after* consuming d by swapping it into the D_R_Pair object?
--
Wayne
Loading...