Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site decwrl.UUCP
Path: utzoo!watmath!clyde!cbosgd!cbdkc1!desoto!packard!hoxna!houxm!whuxlm!akgua!sdcsvax!dcdwest!ittvax!decvax!decwrl!joel
From: joel@decwrl.UUCP (Joel McCormack)
Newsgroups: net.lang,net.lang.pascal
Subject: Hashing is not O(1), period.
Message-ID: <507@decwrl.UUCP>
Date: Fri, 8-Feb-85 21:11:19 EST
Article-I.D.: decwrl.507
Posted: Fri Feb  8 21:11:19 1985
Date-Received: Sun, 10-Feb-85 06:28:31 EST
Organization: DEC Western Software Lab, Los Altos, CA
Lines: 28
Xref: watmath net.lang:1403 net.lang.pascal:231

-     Hashing IS NOT an O(1) operation!
- 
-     Hashing is an O(N)/buckets operation, where many times you can use enough
- buckets to make it very fast.

    This was my original message.  I have now gotten messages from three
individuals telling me, with various arguments about how to do good hashing
and non-collision, that I am wrong.

    I started to answer personally, but the traffic has gotten large enough
that I'm back here on this board.

    Look at pages 104-108 of Knuth, The Art of Computer Programming, Vol. 1.
Section 1.2.11 is titled "Asymptotic Representation."  You cannot place a
restriction on the size of a problem and then use big-O notation.  O notation
specifically addresses unbound functions, and how the function (or algorithm)
behaves dependent upon problem size (for example, number of records in the
dictionary being searched).

    The fact (alluded to in my original message, but evidently not made clear 
enough) that in many practical cases hashing can be used to give a bounded 
(and possibly constant) lookup time for a bounded dictionary has nothing to
do with being O(1).

-- 
- Joel McCormack {ihnp4 decvax ucbvax allegra}!decwrl!joel
		 joel@decwrl.arpa