Distance from string editing to zhenyan
If you do not enter, you will leave.
Introduction
This is the second time I did the chapter 9 algorithm question. It was the first time I wrote the code for his question. His questions are very good, novel, and keep pace with the times.
Question
There are two strings A and B. You can perform the following operations on A: Insert A character, delete A character, and replace A character. Q: How many operations can A change to B? We define this result as the minimum editing distance of the string.
Idea (learning from the nine-Chapter algorithm is quite good, so we can implement it and learn it together)
String editing distance is classified as DP, so it is superb.
Lab
Code
Test. cpp
#include
#include
using namespace std;// get the minest number of three numbersint min(int a,int b,int c);// get the minest distance of string a and bint zifuchuan_bianji_juli(string a,string b);int main(){string a,b;cout<<"please input string a and b"<
>a>>b;cout<<"a=\""
c)return c;else return b;}else if(a>c)return c;else return a;}