If you want to do quick searching, before you look at algorithms, you should
look at data-structures. Read about Skip-Lists. They are as good as Red-Black
trees but easier to implement (and understand). This video is pretty good.
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-046j-introduction-to-algorithms-sma-5503-fall-2005/video-lectures/lecture-12-skip-lists/
As soon as one types a character, you can quickly search the location of
starting point of that character-group in main-list. That would take O(26) in
worst case. When you type second character, you have two choices, create another
skip lists if character group is large or search "efficiently" in the character
group. This is without database approach. You loose everything once the
application terminates. This should be good enough, for searching over a million
record is not a big deal these days.
Do you have any data-base at your disposal, like sqlite? It would be a good time
to have a look at SQL database. In database, you can update the no of times a
word was used (and perhaps the patter of use also). People usually use extensive
computation to populate some kind of data-bases which they can query later to
give a suggestion. Updating database is very critical and writing fast queries
also. That is one architecture you can exploits.
If you are interested in ideas, see Ravi Kannan work on Searching. And pay
attention in your linear algebra class, if you wish to design good search
engines later in your life.
--
Dilawar
NCBS Bangalore
EE, IIT Bombay