If you did the binary search method, you would find the indexes of the first occurrence of your prefix and the last occurrence via search.
If you put all your strings into a Trie instead of the list, all you have to do is walk down the trie with your prefix and grab all the words underneath that node.
If you look inside the while loop, you'll see I'm trying to remove the result that's found from the list so it's not found and returned again. However, I'm getting 9, 10, 9, 10 because as the items are removed, the list becomes shorter.
I could replace the resulting string with another random string instead of removing it completely, but that would mean the list is not sorted in alphabetical order anymore.
Basics of options trading youtube|
Books how to learn forex trading