The problem is that the BinarySearch method has to run several times through a loop so that it returns all the matching strings in the list and not just one. This will just search both ways in the list and perform your action until it gets to an invalid string, which will then break the loop. Thus 1500 is not really a huge number binary search on sorted list would be enough probably. If you have the list in alpabetical order, you can use a variation of binary search to make it a lot faster.


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
Penny trading
Books how to learn forex trading


Comments

  1. orxan_yek

    Rewards, in addition to huge losses, when trading binary options.

    27.11.2015

  2. 45345

    The holders of the earlier account some time, however in the United.

    27.11.2015

  3. Sibelka

    Buying and selling binary options buying.

    27.11.2015

  4. Desant016

    Spread Another review for a software claims that.

    27.11.2015