Mail Archives: djgpp-workers/2001/02/13/11:12:11
On Tue, 13 Feb 2001, Laurynas Biveinis wrote:
> But hash tables deal with full filenames only; I put a prefix
> 'gcc-3.0/libjava' in it, but 'gcc-3.0/libjava/foo' generates a different
> hash code, and the match isn't detected. Maybe in this case my linked
> lists would make the code less complicated?
You can always check all parent directories against the hash table, i.e.
instead of testing only "gcc-3.0/libjava/foo", you'ld also check if
"gcc-3.0/libjava" and "gcc-3.0" are in the hash table.
Linked lists are a lot slower than hash tables, as soon as there are
lots of entries. Hash tables have a probabilistic behaviour of average
O(1) search time, and worst-case O(n). Linear lists are always O(n)
on average, too.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -