理解伪代码的一些问题
我最近在作业中遇到一些问题任何专家都可以告诉我下面的伪代码中的 settiles={} 是什么意思吗?
这就是我所拥有的:
Greedy-String-Tiling(sToken,tToken)
{
tiles={};
do
{
searchLength=MinML;
matches={};
ForallunmarkedtokenssTokensinsToken
{
ForallunmarkedtokensintTokensintToken
{
j=0;
while(sToken+j==tToken+j&&unmarked(sToken+j)&&unmarked(tToken+j))
j++;
if(j==searchLength)
[B]matches=matches?match(s,t,j);[/B]
elseif(j>searchLength)
{
[B]matches={match(s,t,j)};[/B]
searchLength=j;
}
}
}
Forallmatch(s,t,searchLength)?matches
{
Forj=0...(searchLength 1)
{
mark(sFiles+j);
mark(tFilet+j);
}
tiles=tiles?match(s,t,searchLength);
}
}while(searchLength>MinML);
returntiles;
}
我希望知道 tiles={}
和 matches={}
的含义。
I'm facing some problems for my assignment recently Can any expert tell me what is meant by set tiles={} in the following pseudo code?
This is what I have:
Greedy-String-Tiling(sToken,tToken)
{
tiles={};
do
{
searchLength=MinML;
matches={};
ForallunmarkedtokenssTokensinsToken
{
ForallunmarkedtokensintTokensintToken
{
j=0;
while(sToken+j==tToken+j&&unmarked(sToken+j)&&unmarked(tToken+j))
j++;
if(j==searchLength)
[B]matches=matches?match(s,t,j);[/B]
elseif(j>searchLength)
{
[B]matches={match(s,t,j)};[/B]
searchLength=j;
}
}
}
Forallmatch(s,t,searchLength)?matches
{
Forj=0...(searchLength 1)
{
mark(sFiles+j);
mark(tFilet+j);
}
tiles=tiles?match(s,t,searchLength);
}
}while(searchLength>MinML);
returntiles;
}
I hope to know what is meant by tiles={}
and matches={}
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
伪代码应该易于阅读和理解。这很难被称为伪代码,尽管它本来就是这样的。无论如何,这里的
tiles={}
和matches={}
是sets
或arrays
。Pseudo code Should be easy to read and understand. This could hardly be called pseudocode, though it is intended as such. Anyhow,
tiles={}
andmatches={}
aresets
orarrays
here.