Problem 1:
We return to the DNA class from Assignment 3. The most frequent k-mer problem seeks the set of substrings of length k (where integer k is an input) that occur most frequently. We add to the DNA class a most_frequent_kmers method that gets called with integer k and returns an array whose first element is the set of k-mers that occur most frequently in this DNA and whose second element is the number of times each one appears.
>> dna1 = DNA.new('ATTGATTCCG')
=> ATTGATTCCG
>> dna1.most_frequent_kmers(1)
=> [#, 4]
>> dna1.most_frequent_kmers(2)
=> [#, 2]
>> dna1.most_frequent_kmers(3)
=> [#, 2]
>> dna1.most_frequent_kmers(4)
=> [#,
1]
Attachment:- Assignment 3 problem.rar