Mail Archives: djgpp-workers/2001/02/13/12:44:01
> 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.
Yes, I've done my CS homework ;-), but you should consider few other
things - hash tables are very good for file name mappings, because there
are many of them. However, a set of directories to skip is going to be
much smaller (I can barely imagine more than a few). So in this case
linked lists aren't that bad. And cleaner to implement than checking
all parent directories, I think.
Of course, corrections to my thoughts are welcome ;-)
Laurynas
- Raw text -