Question: Write a program in C: The program shows the string alignment and the cost per aligned/matched pair between two input strings. Your solution can be
Write a program in C: The program shows the string alignment and the cost per aligned/matched pair between two input strings. Your solution can be either recursive or iterative. Hint: Remember that the alignment can be longer than the longest string! For example the best alignment between strings: abcdefghijk cdXYZefgh is: abc---defghijk --cXYZdefgh--- This alignment has cost 8. A pair of strings could have several different alignments that have the optimal cost and therefore are all correct answers. Any one of the alignments will be considered correct and sufficient (you do NOT need to list all of them or a specific one). See below and example of 2 different possible alignments. For the 'cat' and 'cs' strings there are two possible alignments, one alignment is: c a t c s - . x x another alignment is: c a t c - s . x x Either alignment will be considered correct. They depend on what you use as the minimum when 2 or all 3 distances are equal to the minimum distance. The 3-rd string shows the cost for each pair. A dot represents a cost of 0 and an x represents a cost of 1 (insert/delete/change). (The number of x-es shown must equal the edit distance between the strings. In this example the edit distance between "cat" and "cs" is 2 (it matches the distance in the bottom right corned of the distance table).)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
