Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!yale!mintaka!bloom-beacon!glassw From: glassw@athena.mit.edu (William B Glass) Newsgroups: comp.lang.lisp Subject: optimizing array lookups - need help Keywords: arrays, optimizing, lists, search Message-ID: <1990Feb26.192502.17990@athena.mit.edu> Date: 26 Feb 90 19:25:02 GMT Sender: news@athena.mit.edu (News system) Reply-To: glassw@athena.mit.edu (William B Glass) Organization: Massachusetts Institute of Technology Lines: 26 I am currently working on a project that involves creating a lookup routine for an online (English) dictionary. Words are stored in nested (1D) arrays and lists. At each level words are indexed by the current letter. For example, at the top level, "apple", "banana", and "cherry" would all be in seperate substructures. I would like to optimize this by storing each level as either an array or list depending on the number of elements. For example, if there are only three words beginning with "smi" it is faster to use a list than an array to look the words up in. However, the combination "st" is followed by almost every other possible letter, and thus would be faster if I used a 26 element array. Does anyone know where the appropriate cutoff point should change from lists to arrays for quicker indexing? My guess is between 5 and ten, but it would help if someone else had any info an this. I'm not a regular reader of this list, so I would appreciate email. Thanks in advance. William Glass Massachusetts Institute of Technology / Standard Disclaimer -- Will Glass