posted 17 years ago
Let me commend the MIT textbook "Introduction to Algorithms" (McGraw-Hill) to you. Although I have a number of good books on such things, it's one of the best - ranking right up there with Knuth's Art of Computer Programming (and, unlike Knuth, doesn't resort to an "assembly language").
The average retrieval time for an element in an ArrayList is X+N/2, since on average, half the elements in the list will have to be examined. X is the fixed overhead for accessing the list at all and is normally insignificant.
For a simple (perfect) Hash, the average retrieval time is going to be simply O, were O is the overhead for calculating the hash and retrieving the element. Hashtables with colliding elements take somewhat longer, since the overflow has to be scanned as well.
The problem with getting rid of the "undesirables" is that sooner or later someone will decide that YOU are an undesirable.