Tag: np complete

解决XKCD中的NP完全问题

有问题的问题/漫画: http : //xkcd.com/287/ 我不确定这是做到这一点的最好方法,但是到目前为止,这是我所想到的。 我正在使用CFML,但它应该是任何人都可读的。 <cffunction name="testCombo" returntype="boolean"> <cfargument name="currentCombo" type="string" required="true" /> <cfargument name="currentTotal" type="numeric" required="true" /> <cfargument name="apps" type="array" required="true" /> <cfset var a = 0 /> <cfset var found = false /> <cfloop from="1" to="#arrayLen(arguments.apps)#" index="a"> <cfset arguments.currentCombo = listAppend(arguments.currentCombo, arguments.apps[a].name) /> <cfset arguments.currentTotal = arguments.currentTotal + arguments.apps[a].cost /> <cfif arguments.currentTotal […]

什么是“P = NP?”,为什么这么着名?

P = NP是否可能是计算机科学领域最着名的问题。 这是什么意思? 为什么这么有趣? 哦,为了额外的功劳,请张贴陈述真相或虚假的证据。 🙂

什么是计算机科学的NP完整?

什么是NP完全问题? 为什么这是计算机科学中的一个重要话题?

从大小为n的列表中找出哪些数字总和为另一个数字的algorithm

我有一个十进制数(让我们称之为目标 )和一个其他十进制数字(让我们调用数组元素 )的数组,我需要find所有数组的元素 ,总结到目标。 我喜欢C#(.Net 2.0)中的解决scheme,但最好的algorithm可能会赢。 您的方法签名可能如下所示: public decimal[][] Solve(decimal goal, decimal[] elements)