7 kyu

Genetic Algorithm Series - #3 Crossover

745 of 2,070gabrielsiedler

Description:

In genetic algorithms, crossover is a genetic operator used to vary the programming of chromosomes from one generation to the next.

The one-point crossover consists in swapping one's cromosome part with another in a specific given point. The image bellow shows the crossover being applied on chromosomes 1011011001111 and 1011100100110 with the cut point (index) 4:

In this kata you have to implement a function crossover that receives two chromosomes chromosome1, chromosome2 and a zero-based index and it has to return an array with the crossover result on both chromosomes [chromosome1, chromosome2].

Example:

crossover('111000', '000110', 3) should return ['111110', 000000']

See other katas from this series

This kata is a piece of 2 kyu Binary Genetic Algorithm

Strings
Algorithms
Genetic Algorithms

More By Author:

Check out these other kata created by gabrielsiedler

Stats:

CreatedDec 25, 2015
PublishedDec 25, 2015
Warriors Trained3092
Total Skips159
Total Code Submissions4934
Total Times Completed2070
JavaScript Completions745
C# Completions303
Python Completions795
Ruby Completions101
PHP Completions143
TypeScript Completions103
CoffeeScript Completions10
Total Stars39
% of votes with a positive feedback rating93% of 402
Total "Very Satisfied" Votes348
Total "Somewhat Satisfied" Votes48
Total "Not Satisfied" Votes6
Total Rank Assessments16
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • gabrielsiedler Avatar
  • jhoffner Avatar
  • ChristianECooper Avatar
  • NaMe613 Avatar
  • brunolm Avatar
  • fuCtor Avatar
  • donaldsebleung Avatar
  • siebenschlaefer Avatar
  • kazk Avatar
  • FArekkusu Avatar
  • hobovsky Avatar
  • dfhwze Avatar
  • saudiGuy Avatar
  • AmirTallap Avatar
Ad