计算机科学中的复杂性

 

There are two fundamental ways of measuring complexities

度量复杂性的基本方式有两种:

Complexity of algorithms 算法复杂性
For an algorithm  A, the (worst-case) time complexity of  A is the maximum running time over all inputs  x of length  n.
对于一个算法A来说,A的(最差)时间复杂性是其对n长的输入x的最大的运行时间
Complexity of problems 问题复杂性
For a computational problem, its time complexity is the time complexity of the  optimal algorithm which solves the problem.
对于一个计算问题,它的时间复杂性是解决这一问题的最优算法的时间复杂性

The complexity of an algorithm tells how good the algorithm is, yet the complexity of a problems tells how hard the problem is. While the former is what we care mostly about in practice, the later is more about the fundamental truths of computation.

 

 

算法复杂性告诉我们一个算法有多么好,而问题复杂性则说明一个问题有多么困难。前者,我们关注的是其应用。后者,是其计算上的根本事实。

 

 

复杂性类

 

Definition 1: The class P is the class of decision problems that can be computed by polynomial time algorithms.

Definition 2: The class NP consists of all decision problems f that have a polynomial time algorithm A such that for any input x,
f(x) = 1 if and only if  /exists yA(x,y) = 1, where the size of  y is within polynomial of the size of  x

Common misuses of the terminology:

  • "This algorithm is NP." --- NP is a class of decision problems, not algorithms.
  • "This problem is a NP problem, so it must be very hard." --- By definition, a problem is in NP if it's positive instances are poly-time verifiable, which implies nothing about the hardness. You probably means the problem is NP-hard.
  • "NP problems are the hardest problems." --- There are infinitely many harder problems outside NP. Actually, according to a widely believed conjecture, there are infinitely many classes of problems which are harder than NP

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值