阅读背景:

当C中存在冲突(使用单独的链接)时,无法释放哈希表中的节点

来源:互联网 

Ok so I have a hash table that I made in C. I'm using separate chaining (linked lists) to resolve collisions. I noticed that I can free the entire table IF there were no collisions and every item hashed to its own index. BUT if there is a collision and I have more than one value at an index, it is only able to free the first value and not the remaining values in that index. The program crashes when it tried to free the others at that index. I tried debugging it and I realized that those other values have been set to NULL, which I'm not sure why because when I'm inserting them to the table I'm using malloc. I know I'm missing something. If someone can help that would be super awesome, as I've been trying to solve this problem for several hours :/Ok so I have a hash table that I made in C. I'm




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: