NP completeness(NP完整性)(Introduction to Algorithms, 算法导论,CLRS)学习笔记

本文是《算法导论》中关于NP完全性的学习笔记,详细探讨了P类问题和NP类问题的定义,以及如何验证解决方案。重点介绍了HAM-CYCLE问题、CIRCUIT-SAT的NP完全性和多项式时间归约。通过证明CIRCUIT-SAT的NP完全性,展示了如何证明一个问题属于NPC。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

NP completeness

  • Here we use binary string in our problems;
  • Call an instance of a problem language, and x ∈ { 0 , 1 } ∗ x\in\{0,1\}^* x{ 0,1} means the input of the language x is encoded in binary; A ( X ) = 1 / 0 A(X)=1/0 A(X)=1/0 means there is a verification algorithm A A A that accepts /rejects the language L L L.
  • x x x in a language is a certain instance(in binary string), remember!!!
  • y y y is one certificate for a instance. A ( x , y ) = 1 A(x,y)=1 A(x,y)=1( A A A is a verification algorithm running in polynomial time) means y y y is a certificate for instance x x x.

1. Definition of P P P

The language L L L could be accept by an algorithm A A A in polynomial time.

2. Definition of NP

2.1 The H A M − C Y C L E HAM-CYCLE HAMCYCLE problem and verification

  • Verification: A A A verifies c c c is a solution to x x x.

  • HAM-CYCLE: An undirected graph G is hamiltonian if it contains a simple cycle containing every vertex of G.

  • Verifying HAM-CYCLE

2.2 Verifying a language

2.3 The complexity of NP

  • Definition: L = { x ∈ { 0 , 1 } ∗ ∣ L=\{x\in\{0,1\}^*| L={ x{ 0,1} there is a y ∈ { 0 , 1 } ∗ y\in\{0,1\}^* y{ 0,1} with ∣ y ∣ = O ( ∣ x ∣ c ) |y|=O(|x|^c) y=O(xc) such that A ( x , y ) = 1 } A(x,y)=1\} A(x,y)=1}
  • If L ∈ P L\in P LP then L ∈ N P L\in NP LNP: we can easily find a verification algorithm for a P class language which runs in polynomial time.

2.4 Polynomial-time reducibility

  • L 1 ≤ P L 2 ∧ L 2 ∈ P − − > L 1 ∈ P L_1\le_{P}L_2\land L_2\in P-->L_1\in P L1PL2
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值