01-03-2006, 11:00 AM
GenericKen,Jan 1 2006, 09:13 AM Wrote:the roulette wheel implementation is O(n^2) iirc (or maybe O(n logn) if you cumulate the fitnesses and do a search on them). I'd like a second opinion on this, though.If you keep them in a sorted list based on fitness (assuming that fitness is a calculation internal to an organism, (i.e. doesn't change when your list changes)) then it wouldn't be O(n^2)...you could also maintain the cumulative fitness of the population. It does however mean that you take a hit on insertion (& deletion) so the overall runtime may end up back looking like O(nlogn)?
[right][snapback]98419[/snapback][/right]