I don't see the original code is a huge issue per se which requires 19 levels? of improvement? I'm curious about how you guys move on though. Will appreciate if you can keep post your solution and progress.
I guess at the end of the entire program, people may learn how to send the query to multiple indexing servers in a concurrent (I prefer this than "distributed") system and then gather together of all the results. At the end of it, it shows how advanced algorithms Google search engine is used to index terabyte of data.
Is that the ultimate solution for a web of data? Take a look of the discussion: http://bit.ly/1f7xIve
From the "best" score I was worse than it by 150 or something. Not that I care really.
http://www.algolist.net/Algorithms/Binary_search
This is my original answer! I should not sort the input list though since it's not necessary.
But is string.indexOf() will be even faster?