This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Less optimal implementation | |
class Deque { | |
constructor() { | |
this.deque = []; | |
} | |
addToFront(item) { | |
this.deque.unshift(item); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DNA Sequence | |
The information in DNA is stored as a sequence of four chemical bases (adenine, guanine, cytosine, and thymine). | |
These four bases are often represented by the letters A, G, C and T. Sequences of DNA, then, can be represented by | |
strings of these characters. | |
Imagine the task of checking whether a given genome (long string of "ACGT" bases) contains a specified gene | |
(shorter sequence of bases) as a substring. One way to do this is to loop over every index in the genome, | |
and try to match the gene sequence from each location. This will take (in the worst case) a number of steps | |
proportional to the length of the genome multiplied by the length of the gene sequence. |