From: William B Glass
Subject: optimizing array lookups - need help
Date: 
Message-ID: <1990Feb26.192502.17990@athena.mit.edu>
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  <······@athena.mit.edu>
Massachusetts Institute of Technology           / Standard Disclaimer
--
Will Glass