ç·¨éè·é¢(edit distance)ã¨ã¯äºã¤ã®æååãã©ã®ç¨åº¦ç°ãªã£ã¦ãããã示ãæ°å¤ã§ãããã¬ã¼ãã³ã·ã¥ã¿ã¤ã³è·é¢(Levenshtein distance)ãæããã¨ãå¤ããæåã®æ¿å ¥ãåé¤ãç½®æãããããä¸ã¤ã®æä½ã¨ãã¦å¿ è¦ãªæä½ã®æå°æ°ãæ±ãããã®ã ãä¾ãã°ãkittenã¨sittingã®ç·¨éè·é¢ãæ±ããå ´åãä¸è¨ã®ããã«3åã®æä½ã§kittenãsittingã«å¤æ´ã§ããã®ã§ç·¨éè·é¢ã¯3ã¨ãªãã 1. sitten (k ã s ã«ç½®æï¼ 2. sittin (e ã i ã«ç½®æï¼ 3. sitting (g ãæ¿å ¥) ããã§ä»åã¯ç·¨éè·é¢ãæ±ããè¤æ°ã®ã¢ã«ã´ãªãºã ã«ã¤ãã¦C++ã§å®è£ ãã¦ã¿ãã åçè¨ç»æ³ ç·¨éè·é¢ãæ±ãããã£ã¨ãä¸è¬çãªã¢ã«ã´ãªãºã ã¯ãåçè¨ç»æ³(dynamic programming)ã ãããè¨ç®æéã¯O(mn)ã§ãããæ軽ã ãC++ã§æ¸ããã³ã¼ããä¸ã«ç¤º
{{#tags}}- {{label}}
{{/tags}}