TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Explain P != NP in plain english

1 点作者 testerhn超过 2 年前
Could someone explain P != NP to me like I&#x27;m literally five :-)<p>What is P? What is NP?<p>Why and what part of it is nondeterministic and deterministic? How does verification play into it?<p>Does this only apply to decision (yes&#x2F;no) problems or can it be other problems?<p>What does an equal to and not equal to relationship mean? Why does it matter?<p>Also what is NP-Hard? What is NP-Complete?<p>Thank you!

2 条评论

Someone超过 2 年前
<a href="http:&#x2F;&#x2F;www.catb.org&#x2F;~esr&#x2F;faqs&#x2F;smart-questions.html#before" rel="nofollow">http:&#x2F;&#x2F;www.catb.org&#x2F;~esr&#x2F;faqs&#x2F;smart-questions.html#before</a>:<p><i>“When you ask your question, display the fact that you have done these things first; this will help establish that you&#x27;re not being a lazy sponge and wasting people&#x27;s time. Better yet, display what you have learned from doing these things. We like answering questions for people who have demonstrated they can learn from the answers.”</i><p>Also, knowing what you know and don’t know may make helping you a lot easier, thus increasing the possibility that you’ll get an answer that helps you.<p>In particular, if you did “Try to find an answer by searching the Web.”, did you find <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;P_versus_NP_problem" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;P_versus_NP_problem</a>? If so, what’s insufficient for you in that?<p>(I also think <a href="http:&#x2F;&#x2F;www.catb.org&#x2F;~esr&#x2F;faqs&#x2F;smart-questions.html#forum" rel="nofollow">http:&#x2F;&#x2F;www.catb.org&#x2F;~esr&#x2F;faqs&#x2F;smart-questions.html#forum</a> applies. IMO, this isn’t the forum to ask these kind of question, but will let the community judge that)
评论 #32892277 未加载
评论 #32891857 未加载
AlDante2超过 2 年前
Multiplying two square matrices takes at most a number of operations proportional to the number of the elements of the matrix. So doubling the size of the matrix from 2x2 to 4x4 squares the number of operations. We know algorithms that are slightly better, but in principle the difficulty of multiplying matrices grows as a polynomial of the degree of the matrix - in this case a quadratic polynomial.<p>P is the set of problems which grow as some polynomial in the degree of the problem. We say that it takes polynomial time to solve them.<p>Looking at our matrices - if it takes 5цs to multiply a 2x2 matrix, it will take 4 timrs as long to multiply a 4x4 matrix, and so on.<p>A three dimensional matrix multiplication grows as the cube - a 4x4x4 matrix takes eight times as long as a 2x2x2 matrix.<p>These problems belong to the class of problems which can be solved in polynomial time. This class is called P.<p>Now look at the travelling salesman problem. Here we have to visit each town on a map using the minimum distance travelled. With two towns this is easy. Add a third and you have to compare distances between each pair of towns - a total of three comparisons. Add a fourth town and you are at 24 comparisons. Five towns makes 120 comparisons. The problem grows faster than a square, faster than a cube, faster than any polynomial. The approximation is exponential.<p>These problems belong to the set NP, those for which we know no better solution than evaluating each alternative in a time which is exponential.<p>The Non-deterministic part of NP comes because if we were given an oracle, that magically gave us the solution, it would be really easy to verify that the solution is correct.<p>The fascinating part is that we cannot prove that the two sets are not the same. Maybe Terence Yao will devise an algorithm next year which solve the travelling salesman (Tp) in polynomial time.<p>The reason we (and he) do not believe this is that there are problems which are so hard, that if we can solve one of them in polynomial time, we can solve every problem in NP in polynomial time. TP is one of these. We call such problems NP-complete.<p>Finally, any problem for which we do not know a polynomial time solution is NP hard. These problems,
评论 #32893122 未加载