IDE: Delphi 1 16-bit (Yeah it’s old, no I can’t afford a newer version or the hardware needed to run it. Besides I’m just learning Delphi so it serves the purpose fine.)
I’ve loaded a TOutline with names (to represent an address book). They’re in sorted order. I want to be able to search the outline.
Possible searches:
- the whole name (eg. Frank Allan Smith)
- a partial name (eg. Allan)
What’s a good, fast way to search the outline?
For the sorted list, you can use a binary search for your “BEGINS WITH”, but for the contains, you will need to do a linear search (evaluating every item). Its been awhile since I’ve worked with Delphi 1, but here is the linear search:
The linear search: