散列(哈希)表中的直接寻址表,有什么用?
我理解的是,要存储的东西是
struct KeyWithData
{
int key;
char* str;
}
存在一个KeyWithData数组里
KeyWithData arr[LEN];
那这样和char* [LEN]有啥区别啊,
[解决办法]
For some applications, the direct-address table itself can hold the elements in the
dynamic set. That is, rather than storing an element’s key and satellite data in an
object external to the direct-address table, with a pointer from a slot in the table to
the object, we can store the object in the slot itself, thus saving space. We would
use a special key within an object to indicate an empty slot. Moreover, it is often
unnecessary to store the key of the object, since if we have the index of an object
in the table, we have its key. If keys are not stored, however, we must have some
way to tell whether the slot is empty.