I am attempting to write a Genetic Algorithm based on techniques I had picked up from the book \"AI Techniques for Game Programmers\" that uses a binary encoding and fitness
I have implemented this algorithm by creating a "cumulative fitness array" and binary search, thus reducing the need to iterate through each element in the array during the selection:
Note that you only need to create the fitness array at the start of the reproduction phase, and can then re-use it multiple times to perform selections in O(log N) time.
As an aside, note that tournament selection is far easier to implement!