Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

The class random _ generator has been updated ( random _ generator.h and ran - dom _ generator.cc ) by a member function which generates

The class random_generator has been updated (random_generator.h and ran-
dom_generator.cc) by a member function which generates random strings of a fixed
length using the a given number of characters from the alphabet, starting with "a".
char* random_string_m(int n, int no_ch)
The function allocates n+1 characters. The first n characters (0dotsn-1)
are chosen at random using the first no_ch characters from the alphabet start-
ing with "a"(e.g., for no_ch =4 the characters are randomly chosen out of
{a,b,c,d}. The n-th character is set to 0 in order to mark the end
of the string.
Dynamic programming (70 points)
The dynamic programming Smith-Waterman algorithm is matching sequences recur-
sively defined as follows, given x=x1,dots,xn(along table rows) and Y=y1,dots,ym
(along table columns).
M(i,0)=0, for all 0in
M(0,j)=0, for all 0jm
M(i,j)=max{M(i-1,j-1)+2ifxi=yj
M(i-1,j-1)-1ifxiyj
M(i-1,j)-1if-is inserted into Y
M(i,j-1)-1if-is inserted into x
The function M(i,j) defines a so called matching score for the partial sequences xi
and Yj. If in the recursive definition of M the maximum value is due to the third
or fourth line, you have to insert the character "-" into either x or Y in order to
reconstruct the matching sequences x' and Y'. Similar to the LCS problem we need
only need a table to store the M(i,j) values, but an additional table that allows us
to later generate x' and Y' from x and Y.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started