@@ -77,15 +77,15 @@ std::vector<std::vector<CppEditop>> backtrack_all_paths(
7777 const double tol = 1e-6 ;
7878
7979 if (i > 0 && std::abs ((dp[i-1 ][j] + delete_weight) - current_cost) < tol) {
80- CppEditop op (DELETE, i-1 , i- 1 , delete_weight, std::string (1 , a[i-1 ]));
80+ CppEditop op (DELETE, i-1 , j , delete_weight, std::string (1 , a[i-1 ]));
8181 current_path.push_back (op);
8282 auto paths = backtrack_all_paths (a, b, dp, i-1 , j, current_path, replace_weight, insert_weight, delete_weight, swap_weight);
8383 all_paths.insert (all_paths.end (), paths.begin (), paths.end ());
8484 current_path.pop_back ();
8585 }
8686
8787 if (j > 0 && std::abs ((dp[i][j-1 ] + insert_weight) - current_cost) < tol) {
88- CppEditop op (INSERT, i, i , insert_weight, std::string (1 , b[j-1 ]));
88+ CppEditop op (INSERT, i, j- 1 , insert_weight, std::string (1 , b[j-1 ]));
8989 current_path.push_back (op);
9090 auto paths = backtrack_all_paths (a, b, dp, i, j-1 , current_path, replace_weight, insert_weight, delete_weight, swap_weight);
9191 all_paths.insert (all_paths.end (), paths.begin (), paths.end ());
0 commit comments