English 中文(简体)
2. 从规定的一组词中最短的措辞
原标题:Find shortest combination of words that contain every character from a specified set

我只读一个字体(如dog,>,fish,run,programming,任何内容),这些字体确实是巨大的。

我可将<代码>a1中的任何词语与任何其他词语(例如,你可将<代码>dog和programming并入dog-programming)合并起来,然后又一次,直到扼杀物真正大。

我也看一阵列(简称为a2) (例如de,s,x?,umh,再说一遍,它们可能远远没有意义)。 保证在<代码>a2上不作指示 这一点不能在1号指示中找到。

我所期待的是最短的扼杀(根据它需要多少组合才能产生这种扼杀,而不是说明含有多少特性),其中包括在<代码>a2内的所有扼杀。 如果不止一次地表明,所有这种最低期限都是如此,我就只能拿到任何东西,并且可以逃脱。

现在,我不认为我可以这样作,因为即使阵列相对较小,几乎没有任何办法把言词结合起来,但我爱被证明是错误的!

能否找到最短的路,肯定会取得最短的结果,或者我是否不得不使用冷却算法,只是寻找粗略的短str?

我只是试图从一只一只一只一只一只一只一只一只一只,然后将这些物品从两件中删除,然后又一次开始,但是它却不工作! 它产生良好结果,但并非最佳结果。

问题回答

如果你把言词与你的例子一样,例如:

dog + programming + sky = dog-programming-sky

而A2中的措辞并不含有 da,因此它只是一个伪装的SET-C监文,是一个由国民组成的优化问题。 那么,你就可以利用为SET-Cwatch提供的任何解决方案战略解决这一问题。 对SET-Cwatch有快速近似值算法,但如果你想找到最基本的解决办法,则需要采用最坏的指数算法。

如果你把字句放在一起,就象这样。

dog + programming + sky = dogprogrammingsky

这样,问题就更加困难,因为现在,例如,“集体”在合并的词中找到,即使它只是任何组成方的缩略语。





相关问题
How to add/merge several Big O s into one

If I have an algorithm which is comprised of (let s say) three sub-algorithms, all with different O() characteristics, e.g.: algorithm A: O(n) algorithm B: O(log(n)) algorithm C: O(n log(n)) How do ...

Grokking Timsort

There s a (relatively) new sort on the block called Timsort. It s been used as Python s list.sort, and is now going to be the new Array.sort in Java 7. There s some documentation and a tiny Wikipedia ...

Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Enumerating All Minimal Directed Cycles Of A Directed Graph

I have a directed graph and my problem is to enumerate all the minimal (cycles that cannot be constructed as the union of other cycles) directed cycles of this graph. This is different from what the ...

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...

热门标签