NP

NP (for nondeterministic polynomial time) is a complexity class used to describe certain types of decision problems.

deterministic

一个 deterministic 的算法,由一连串的步骤唯一地确定,也就是说,给定一个输入,和执行过程中的一步,那么由该算法确定的下一步是唯一的。

In computer science, a deterministic algorithm is an algorithm which, given a particular input, will always produce the same output, with the underlying machine always passing through the same sequence of states. Deterministic algorithms are by far the most studied and familiar kind of algorithm, as well as one of the most practical, since they can be run on real machines efficiently.[wikipedia]

例如:图灵机
图灵机是什么

一个 nondeterministic 的算法,在做决定的时候,可以make a guess,猜一下。

怎么使得一个算法变得 non-deterministic
1. 使用外部变量,例如 全局变量,用户输入,随机变量等
2. 它是时间敏感的,例如 多处理器同时向一个空间写,结果将取决于顺序
3. 硬件出错

P

一个P问题:使用deterministic algorithms可以在多项式时间内解决

NP

NP: 使用 non-deterministic algorithms可以在多项式时间内解决

Informally, NP is the set of all decision problems for which the instances where the answer is “yes” have efficiently verifiable proofs. More precisely, these proofs have to be verifiable by deterministic computations that can be performed in polynomial time.

NP-complete problems

https://www.zhihu.com/question/27039635

reducibility of algorithm

可以认为各个问题的难度是不同的,表现形式为,如果我可以把问题A中的一个实例转化为问题B中的一个实例,然后通过解决问题B间接解决问题A,那么就认为B比A更难。

A problem P1 is reducible to another problem P2 if there is a way of encod- ing instances x of P1 as instances y = r(x) of P2 using a reduction function r ex- ecuted with a reduction algorithm; that is, for each x, x is an instance of P1 if y = r(x) is an instance of P2.

The reason for the reduction is that if the value r(x) for any x can be found ef- ficiently (in polynomial time), then an efficient solution for y can be efficiently trans- formed into an efficient solution of x. Also, if there is no efficient algorithm for x, then there is no efficient solution for y.

NP-complete

一个问题被称为 NP-complete 的,如果
1. 它是 NP的
2. 每一个NP问题都可以 polynomially reduced to this problem

由于 reducibility 是传递的,我们可以说 NP problem P1是NP-complete的如果存在一个 NP-complete problem P2可以 polynomially reducible to P1.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值