9-Chapter interview questions algorithm string editing distance

Source: Internet
Author: User

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;}
      
     
    
   


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.