In hash-tables, each entry has an hash calculated from it using the primary keys. A collision occurs when two entries have the same hash. This has nothing to do with foreign keys... In hash-tables, each entry has an hash calculated from it using the primary keys. A collision occurs when two entries have the same hash. One solution to a collision is to put hash collision entries one after another in a linked list. These lists are called hash-chains. Hash-tables allow us to find records using a single dereference through an array (or table). Binary trees are a completely different construction, using left and right branches to find things using a type of "binary chop". Primary keys are used to create the hash for each record, but using them is normal and in no way guarentees hash collisions will be avoided. Perhaps the second-best answer... If we have no way to support hash collisions if they occur (such as using hash chains) then a hash table will break if there is any hash collisions. However, they are usable if we use something like hash chains, so this answer is not 100% true.
|
|