Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2000:
[Freeciv-Dev] Hash tables
Home

[Freeciv-Dev] Hash tables

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Hash tables
From: Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 26 Mar 2000 15:34:49 +0100 (WET DST)

Well, i don't want anyone to think that i'm spamming the freeciv-dev list
but... :)

Here is another problem with the hash tables...

Colisions aren't solved.

Usually an hash table is like this:


Buckets

 ----
 |  |
 ----      ----
 |  |----->|  |
 ----      ----
 |  |
 ----      ----     ----
 |  |----->|  |---->|  |
 ----      ----     ----
 |  |
 ----

i.e. each bucket contains a list of nodes.

In the current implementation, each bucket can contain only one node.
So if there is a colision, we have a big problem.

Also, the size of an hash table (number of buckets) should be a prime
number to reduce the number of colisions.

---
Vasco Alexandre da Silva Costa @ Instituto Superior Tecnico, Lisboa




[Prev in Thread] Current Thread [Next in Thread]