Develop a data type to store the genome of an organism. Biologists often abstract the genome to
Question:
Develop a data type to store the genome of an organism. Biologists often abstract the genome to a sequence of nucleotides (A, C, G, or T). The data type should support the methods addNucleotide(char c) and nucleotideAt (int i), as well as isPotentiaTGene() (see Program 3.1.1). Develop three implementations. First, use one instance variable of type String, implementing addCodon() with string concatenation. Each method call takes time proportional to the length of the current genome. Second, use an array of characters, doubling the length of the array each time it fills up. Third, use a boolean array, using two bits to encode each codon, and doubling the length of the array each time it fills up.
Step by Step Answer:
Introduction To Programming In Java An Interdisciplinary Approach
ISBN: 9780672337840
2nd Edition
Authors: Robert Sedgewick, Kevin Wayne