What is the fastest way to search a client-side database?
I have about 60-65 kb of data downloaded to the client which is
present in 3 dynamically created list boxes. The boxes are filled from
3 string arrays, which are just lists of people or companies in
alphabetic order. These names may have accented and umlauted
characters (which are present as the plain ASCII - not as the entity
&# character). The page is UTF-8 encoded.
e.g. strManager = "Adele Brown|Albert Meinstein|Alicia Perkins ..."
The first defect of the search is that it won't look for items
beginning with an umlaut etc.
The second defect is that it's far too slow.
The current page uses a regular expression search on the whole string
(it was taken from the O'Reilly regular expression book. Entering, for
instance, a 'b' in the search box results in the corresponding list
box showing ONLY those items beginning with a 'b' or 'B'. Likewise
entering 'Ba' narrows the search down even further. Unfortunately the
first letter search takes too much time.
What data structure is best used for holding the data for this search?
Should I construct a binary-search-tree on the server using the ids of
the actual data items (with left and right pointers) - created using
an associative array? With such a structure would a binary search
algorithm give me the fastest search?
PS: in the server database all these names have ids (but the previous
developer didn't download them to the client (to "save space").