- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我们可以使用带后缀链接 ( paper here ) 的 factor-oracle 来计算多个字符串的最长公共(public)子串吗?这里,substring 表示原始字符串的任何部分。例如“abc”是“ffabcgg”的子字符串,而“abg”不是。
我找到了一种计算两个字符串的最大长度公共(public)子串的方法 s1
和 s2
.它通过使用不在其中的字符连接两个字符串来工作,例如“$”。然后对于连接字符串的每个前缀 s
长度i >= |s1| + 2
,我们计算它的LRS(最长重复后缀)长度lrs[i]
和 sp[i]
(其 LRS 第一次出现的结束位置)。最后,答案是
max{lrs[i]| i >= |s1| + 2 and sp[i] <= |s1|}
我用这个方法写了一个C++程序,当|s1|+|s2| <= 200000
时,在我的笔记本电脑上可以在200ms内解决问题。 , 使用因子 oracle。
s1 = 'ffabcgg'
s2 = 'gfbcge'
s = s1+'$'+s2
= 'ffabcgg$gfbcge'
p: 0 1 2 3 4 5 6 7 8 9 10 11 12 13
s: f f a b c g g $ g f b c g e
sp: 0 1 0 0 0 0 6 0 6 1 4 5 6 0
lrs:0 1 0 0 0 0 1 0 1 1 1 2 3 0
ans = lrs[13] = 3
我知道这两个问题都可以用suffix-array和suffix-tree来解决,效率很高,但我想知道是否有使用factor oracle来解决的方法。我对此很感兴趣,因为 factor oracle 很容易构造(30 行 C++,suffix-array 大约需要 60 行,而 suffix-tree 需要 150 行),而且它比 suffix-array 和 suffix-tree 运行得更快。
你可以在this OnlineJudge中测试你第一个问题的方法,以及 here 中的第二个问题.
最佳答案
Can we use a factor-oracle with suffix link (paper here) to compute the longest common substring of multiple strings?
我认为该算法不是很合适(它旨在分解单个字符串),但您可以通过使用唯一分隔符连接原始字符串来使用它。
给定abcdefg
和hijcdekl
和mncdop
,找到最长公共(public)子串cd
:
# combine with unique joiners
>>> s = "abcdefg" + "1" + "hijcdekl" + "2" + "mncdop"
>>> factor_oracle(s)
"cd"
作为其线性时间和空间算法的一部分,factor-oracle 快速重新发现输入字符串之间的断点,作为其搜索公共(public)因子的一部分(独特的连接器提供并立即提示停止扩展找到的最佳因子到目前为止)。
关于algorithm - 使用 LRS 数组增强的 factor oracle 查找多个字符串的最长公共(public)子串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11956604/
我正在使用 xapiwrapper.min.js 和类似文件将语句发送到 LRS。我自己的包含 javascript 的文件称为 init.js,如下所示。 Init.js 是从我的其他主要 html
我希望获得 ls -lrS 命令输出的第二行和最后一行。我一直在使用 ls -lrS | (head -2 | tail -1) && (tail -n1) 但它似乎只得到第一行,我必须按控制 C 才
我正在使用ADL LRS设置一个LRS(学习记录存储)系统供我自己使用。它使用TIN CAN API。我使用的是ubuntu服务器 正如文档所述,为了设置 LRS,我需要安装 django 并为 LR
我们正在使用 Azure 存储帐户来存储我们的应用程序应根据用户需求下载的一些文件。 即使不应该有写入操作(至少我能想到没有),但在计费周期的几天内我们就超出了包含的写入操作(参见图片)。 关于价格,
我已在 ubuntu 服务器上设置了 ADL LRS。默认情况下它使用 Postgresql 数据库。我有一个简单的问题,如何更改数据库?我可能想使用 MySql、SQLite 或 MongoDB 来
我正在构建一个基于锡 jar 的 LMS。我们根据本指南从 LMS 启动事件,并为事件提供适当的查询参数,以便与 LRS xapi 端点进行通信。 https://github.com/Rustici
使用 LRS 创建的 Azure 存储帐户有 3 个副本。有没有办法读取这些数据的副本? 最佳答案 简单的答案是否定的。您无法指定要从哪个副本读取数据。 关于azure - 是否可以使用 LRS(本地
使用 LRS 创建的 Azure 存储帐户有 3 个副本。有没有办法读取这些数据的副本? 最佳答案 简单的答案是否定的。您无法指定要从哪个副本读取数据。 关于azure - 是否可以使用 LRS(本地
我们可以使用带后缀链接 ( paper here ) 的 factor-oracle 来计算多个字符串的最长公共(public)子串吗?这里,substring 表示原始字符串的任何部分。例如“abc
我已将 Tin Can 类(class)添加到我的 LMS,并且我能够成功上传和回放该类(class),以便我的语句被写入初始应用领域 LRS。到目前为止一切顺利。 现在我希望能够从 LRS 检索已编
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 7 年前。
我正在尝试创建一个 SCORM 包并为其生成语句。 我想创建本地 LRS 和 Tin Can Api 设置并从我的 scorm 生成语句并在我的 php 页面中显示结果。 我使用以下链接 ( http
问题: 调整 PV 大小后需要增加文件存储大小,但文件存储大小没有改变,即使我将 PV/PVC 设置为 800gi 或 300gi,它仍然停留在 205 apiVersion: v1 kind: Pe
我是一名优秀的程序员,十分优秀!