gpt4 book ai didi

string - 最短公共(public)超弦算法?

转载 作者:塔克拉玛干 更新时间:2023-11-03 03:07:47 26 4
gpt4 key购买 nike

我想在这里解决这个问题: enter image description here

但我想找到一种算法来分解解决问题的步骤。我似乎无法在网上找到任何有用的东西,所以我来这里询问是否有人知道我可以用来引用解决此问题的算法的资源。

最佳答案

这叫做 shortest common supersequence problem .这个想法是,为了使超序列最短,我们希望找到尽可能多的 a 和 b 的共享位。我们可以分两步解决问题:

  1. 找出a和b的最长公共(public)子序列。

  2. 插入 a 和 b 的剩余位,同时保留这些位的顺序。

我们可以解决longest common subsequence problem使用动态规划。

关于string - 最短公共(public)超弦算法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19508095/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com