1 / 23

计算机问题求解 – 论题 1-15 - 问题的难度

计算机问题求解 – 论题 1-15 - 问题的难度. 201 8 年 12 月 25 日. Part I 问题的“固有”难度. 问题 1: 这类拼图问题为什么会很难 ?. 问题 2: 在我们的讨论中, reasonable 这个词是用来修饰什么的,怎么就算 reasonable 呢?. 问题 3 : 在我们的讨论中 tractable 这个词又是修饰什么的呢?它是什么意思?. 问题 3 : 你怎么理解这句话?. Something that slightly annoys or upset you. 问题 4 : 书上举了那些“难”问题的例子?.

jamesrgreen
Télécharger la présentation

计算机问题求解 – 论题 1-15 - 问题的难度

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 计算机问题求解–论题1-15 - 问题的难度 2018年12月25日

  2. Part I 问题的“固有”难度

  3. 问题1: 这类拼图问题为什么会很难?

  4. 问题2: 在我们的讨论中,reasonable这个词是用来修饰什么的,怎么就算reasonable呢?

  5. 问题3: 在我们的讨论中tractable这个词又是修饰什么的呢?它是什么意思?

  6. 问题3: 你怎么理解这句话?

  7. Something that slightly annoys or upset you

  8. 问题4: 书上举了那些“难”问题的例子?

  9. 问题5: 优化问题与判定问题是什么关系,是否一个问题总可以定义其两种形式?你能说说他们的难度有什么关系吗?

  10. Max Clique: an Example • A maximal complete subgraph of a graph G is called a clique, whose size is the number of vertices in it. • Optimization problem: Find the maximal clique in a given graph G. • Decision problem: Has G a clique of size at least k for some given k?

  11. Max Clique Revisited • The max clique problem can be solved in polynomial time iff. the corresponding decision problem can be solved in polynomial time. • If the size of a max clique can be found in time g(n), the corresponding decision may be settled in that time of course. • If deciClique is algorithm for the decision problem with k in the complexity of f(n), then we apply the algorithm at most n time, for k=n, n-1, ..., 2, 1, and we can solve the optimization problem, and with the complexity no worse than nf(n), which is polynomial only if f(n) is polynomial.

  12. Part II P与NP

  13. 问题6: Magic Coins是什么?你能否以图着色为例,说说它在什么情况下有什么样的作用?

  14. Nondeterministic vs. Deterministic In O(1) Note: (n) for deterministic algorithm void nondetSearch(int k; int[ ] S) inti =genCertif(); if (S[i]=k) Output “yes”; return; void nondetSort(int[ ] S; intn) inti, j; int[ ] out=0; fori =1 tondo j= genCertif(); if out[j ]0 then return; out[j]=S[i ]; fori =1 ton-1 do if out[i ]>out[i+1] thenreturn; S=out; Output(yes); return In O(n) Note: (nlogn) for deterministic algorithm

  15. Max Clique Problem is in NP void nondeteClique(graph G; intn, k) setS=; for inti=1 tokdo intt=genCertif(); iftSthen return; S=S{t }; for all pairs (i,j) with i,j in S and ijdo if (i,j ) is not an edge of G then return; Output(“yes”); In O(n) In O(k2) So, we have an algorithm for the maximal clique problem with the complexity of O(n+k2)=O(n2)

  16. Satisfiability Problem An example of propositional conjunctive normal form (CNF) is like this: Satisfiability Problem Given a CNF formula, is there a truth assignment that satisfies it? In other words, is there a assignment for the set of propositional variable in the CNF, such that the value of the formula is true. void nondetSat(E, n) boolean p[ ]; forint i =1 tondo p[i ]= genCertif(true, false); ifE(p[1], p[2], ..., p[n])=true then Output(“yes”); So, the problem is in NP

  17. Solving a Problem Indirectly T(x) x T Algorithm for Q yes or no answer an input for Q (an input for P ) Algorithm for P The correct answer for P on x is yesif and only if the correct answer for Q on T(x) is yes.

  18. 问题7: 如果问题Q可以多项式时间内规约到问题P,关于这两个问题的难度关系你能说些什么?

  19. 问题8: 你能否证明多项式可规约是传递关系?

  20. NP-complete Problems • A problem Q is NP-hard if every problem P in NP is reducible to Q, that is PPQ. (which means that Q is at least as hard as any problem in NP) • A problem Q is NP-complete if it is in NP and is NP-hard. (which means that Q is at most as hard as to be solved by a polynomially bounded nondeterministic algorithm)

  21. 问题9: 你能理解为什么说这个问题是计算机科学中最重要的问题吗?

  22. 课外作业 • DH pp.186- • 7.2, 7.4, 7.6, 7.10,

More Related