[英]How did the problem instance with the parameter size m = logn become 2^(logn)?
Problem Instance and Big-O Notation问题实例和大 O 表示法
Hello,你好,
I am trying to understand a solution to a problem, but I am not understanding a part of the solution as to how the Problem instance was calculated.我试图了解问题的解决方案,但我不了解解决方案的一部分,即问题实例是如何计算的。
Here are the questions and the solutions:以下是问题和解决方案:
"An instance of a 'Perfect' decision problem is an integer n >= 1 and the problem is to decide if n is the sum of each of its proper divisors. For example, 6 is 'Perfect' because 1+2+3 = 6." “'完美'决策问题的一个实例是 integer n >= 1,问题是确定 n 是否是其每个适当除数的总和。例如,6 是'完美',因为 1+2+3 = 6."
Since the input to 'Perfect' is a single integer n, an appropriate size parameter is m = log(n), since this is roughly the number of bits needed to represent n.由于“完美”的输入是单个 integer n,因此适当的大小参数是 m = log(n),因为这大致是表示 n 所需的位数。
"Suppose an algorithm for deciding 'Perfect' requires O(n^2) steps, where n is the problem instance. Use the answer above and Big-O growth terminology to describe the growth of the algorithm's running time" “假设一个决定‘完美’的算法需要 O(n^2) 步,其中 n 是问题实例。使用上面的答案和大 O 增长术语来描述算法运行时间的增长”
The algorithm has exponential running time since n^2 = (2^(logn))^2 = 4^(logn)该算法具有指数运行时间,因为 n^2 = (2^(logn))^2 = 4^(logn)
I can't seem to understand or figure out how the problem instance with the parameter size m = logn become 2^(logn)....我似乎无法理解或弄清楚参数大小 m = logn 的问题实例如何变为 2^(logn)....
We are talking about m
bits.我们正在谈论m
位。 m
is equal to log(n)
, according to the statement.根据声明, m
等于log(n)
。
Now every bit can be either 0 or 1.现在每个位都可以是 0 或 1。
Suppose you have to a representation of 2 bits: _ _
.假设您必须表示 2 位: _ _
。 Each one of them can either be 0 or 1. And possible representations become 2^2=4.它们中的每一个都可以是 0 或 1。可能的表示变为 2^2=4。
Similaryly, the possible values for the above case become 2^m
or 2^log(n)
.同样,上述情况的可能值变为2^m
或2^log(n)
。
As stated by @AbhinavMathur above, the text is clearly wrong.正如上面@AbhinavMathur 所述,文本显然是错误的。 The time to solve the problem is exponential in the number of bits.解决问题的时间在位数上是指数级的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.