Subj : Re: Order-preserving hash of strings To : comp.programming From : Alex Fraser Date : Fri Sep 16 2005 10:53 am "Digital Puer" wrote in message news:1126832235.004650.149620@g43g2000cwa.googlegroups.com... > Hi, suppose I have a list of character strings and want > to hash them to integers for use in a lookup table. The > problem is that the hashed values need to preserve the > order that the strings occurred in the list. For example, > a possible hashing of a list of three strings would be > is 9, 12, 30 respectively; an illegal hashing would be > 7, 5, 2 (this hashing does not preserve the order). This sounds tricky at best, if the list of strings is known in advance and fixed, and probably totally impractical otherwise. Would an array (or list) of the strings in order, and a hash table containing array indexes (or pointers to list items) solve the problem? Alex .