Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 1. (Calculating Edit Distance Using Dnamic Programming) A direct implementation of tbe above recursive scbeme will work, but it is spectacularly inefficient. If both

image text in transcribed
image text in transcribed
Problem 1. (Calculating Edit Distance Using Dnamic Programming) A direct implementation of tbe above recursive scbeme will work, but it is spectacularly inefficient. If both input strings have N characters, then the number of recursive calls will excoed 2V. To overcome this performance bug, we use dymamic programming. Dynamic programming is a powerful algorithmic paradigm, first introduced by Bellman in the context of operations research, and then applied to the alignment of biological sequences by Needleman and Wansch. Dynamic programming now plays the leading role in many computational problems, including control theary, financial engineering, and bioinformatics, including BLAST (the sequence alignment program almost universally used by molecular biologists in their experimental work). The key idea of dynamic programming is to break up a large computational problem iuto smaller subproblems, store the answers to those snaller subproblems, and, eventually, use the stored answers to solve the original problem. This avoids recomputing the same quantity over and over again. Instead of using recurson, use a nested loop that calculates opti u in the right order so that optilli, opt Li + 1300), and opt(4) G 1 are all computed before we try to compute optta)]. Write a program edit distance.py that reads strings and y from standard input and computes the edit-distance matrix opt as described above. The program should output x, y, the dimensions (number of rows and columns) of opt, aind opt itself, using the following format: The first and second lines should contain the strings x and y. . The third line should contain the dimensions of the opt matrix, separated by a space. . The following lines should contain the rows of the opt matrix, cach ending in a newline character. Use stdio.vritetO with the format string z3d to write out the elements of the matrix. s python3 edit distance py

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Marketing Database Analytics

Authors: Andrew D. Banasiewicz

1st Edition

0415657881, 978-0415657884

More Books

Students also viewed these Databases questions