From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ac39a12d5faf5b14 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-04-23 12:09:10 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.cidera.com!Cidera!cyclone.socal.rr.com!cyclone3.kc.rr.com!news3.kc.rr.com!twister.socal.rr.com.POSTED!not-for-mail Message-ID: <3CC5B161.C719C5D8@san.rr.com> From: Darren New X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Grace and Maps (was Re: Development process in the Ada community) References: <3CB46975.90408@snafu.de> <3CBAFFEE.2080708@snafu.de> <4519e058.0204171036.6f0a7394@posting.google.com> <3CBDD795.4060706@snafu.de> <4519e058.0204180800.44fac012@posting.google.com> <3CBF0341.8020406@mail.com> <4519e058.0204190529.559a47ae@posting.google.com> <3CC1C6B3.6060306@telepath.com> <3CC21747.5000501@telepath.com> <4519e058.0204220534.2eb33730@posting.go <3CC48F34.5A474E0F@boeing.com> <3CC49C50.485AE213@san.rr.com> <3CC4B5C0.4D16077C@acm.org> <3CC4E9DA.E02BE0DA@san.rr.com> <7vznzukhzf.fsf@vlinux.voxelvision.no> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Tue, 23 Apr 2002 19:08:42 GMT NNTP-Posting-Host: 66.75.151.160 X-Complaints-To: abuse@rr.com X-Trace: twister.socal.rr.com 1019588922 66.75.151.160 (Tue, 23 Apr 2002 12:08:42 PDT) NNTP-Posting-Date: Tue, 23 Apr 2002 12:08:42 PDT Organization: RoadRunner - West Xref: archiver1.google.com comp.lang.ada:23003 Date: 2002-04-23T19:08:42+00:00 List-Id: Ole-Hjalmar Kristensen wrote: > You're right, you cannot in general guarantee it. But if you use hash > functions which on average change half the bits as a result of a > single bit change in the input, you can rest assured that it will not > happen in practice. I haven't done any safety-critical work, but is this how it's really done? "It's very unlikely this airplane will crash into that nuclear plant, unless 20 items all hash to the same value"? :-) No, seriously... In any case, the hashes still have two problems: 1) You *could* be hosed this way, so while they may be faster, they're still not deterministic, while a red-black tree has a strictly bounded upper limit on the number of operations (given a particular number of nodes) which is much lower than that of a hash table. In other words, the worst-case for a hashtable is still O(N), which if you need realtime and safety-critical, you have to take it into account. 2) You need to be able to hash the value. A red-black tree needs only an ordering operator (like "<"), not something that gropes the insides of an object like a hash needs to. If you want to ensure you have a particularly good hash, then you are going to have trouble with the strong typing in Ada, yes? That is, every type of hash table I create is going to work only if I implement a hash appropriate to the key type, and that'll have to get reimplemented (to some extent at least) for every type. On the other hand, most of the built-in types and metatypes ("record", "array", etc) already have ordering operators or rules on how to deduce them from the components. -- Darren New San Diego, CA, USA (PST). Cryptokeys on demand. The 90/10 rule of toothpaste: the last 10% of the tube lasts as long as the first 90%.