Skip to content

Instantly share code, notes, and snippets.

@sunilnandihalli
Created July 31, 2011 15:39
Show Gist options
  • Save sunilnandihalli/1116896 to your computer and use it in GitHub Desktop.
Save sunilnandihalli/1116896 to your computer and use it in GitHub Desktop.
BitVector Genealogy
The BitVectors are an ancient and immortal race of 10,000, each with a 10,000 bit genome. The race evolved from a single individual by the following process: 9,999 times a BitVector chosen at random from amongst the population was cloned using an error-prone process that considers each bit independently, and flips it with 20% probability.
Write a program to guess the reproductive history of BitVectors from their genetic material. The randomly-ordered file bitvectors-genes.data.gz contains a 10,000 bit line for each individual. Your program's output should be, for each input line, the 0-based line number of that individual's parent, or -1 if it is the progenitor. Balance performance against probability of mistakes as you see fit.
To help you test your program, here is a much smaller 500 x 500 input dataset:bitvectors-genes.data.small.gz, along with its solution file: bitvectors-parents.data.small.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment