CBMS-2015-07

题目来源Question 7 日期:2024-06-14 题目主题:CS-算法-时间复杂度

具体题目

When we analyze the worst time complexity of an algorithm, it is worth observing how the computation time increases as , the size of input data, increases. The Landau’s notation, which is often used for representing an asymptotic upper bound of ignoring the constant factor, is defined as the following. For a positive function , if there exists a positive constant , and

holds, then

is defined to hold.

  1. and are defined to be equal if and are equivalent for any . For each of (A) to (C), find all formulae in the box below that are equal to it. If there is no such formula, just write “none”.

(A) (B) (C)

  1. For each proposition below, determine with proof whether it holds or not. Note that and are positive functions.

(A) and are equal.

(B) If , then .

正确解答

1. Find the equivalent formulas

(A)

  • According to the definition of Big-O notation, the highest order term dominates the growth rate. Therefore, and are equivalent.

(B)

  • In Big-O notation, constant factors and the base of logarithms are ignored, so is equivalent to .

(C)

  • None All other formulas in the box either grow slower or faster than . Therefore, there are no equivalent formulas.

2. Determine the validity of each proposition

(A) and

Proof:

We need to prove:

if and only if:

  1. If , then :
  1. If , then :

Combining these two cases, we get:

Conversely, since :

Therefore:

Hence:

Therefore, the proposition is true.

(B) If , then

Proof:

Assume , meaning there exist positive constants and such that for all ,

We need to prove:

Let’s consider .

Since , we get:

So:

If , then , which is bounded. However, if , grows exponentially and is not bounded.

For example, if and :

Clearly, is not in because its growth rate is much faster. Therefore, in this case, the proposition is false.

Thus, the correct conclusion is that the proposition does not hold.

Knowledge Points

时间复杂度

Problem-Solving Tips and Information

  • When analyzing time complexity, focus on the highest order term.
  • In Big-O notation, different bases of logarithms are considered equivalent.
  • For combined functions (such as ), the complexity can be simplified by analyzing the dominant term.

Key Vocabulary

  • asymptotic 渐近的
  • upper bound 上界
  • equivalent 等价的
  • exponential 指数的
  • limit 极限

References

  1. “Introduction to Algorithms” Chapter 3: Growth of Functions
  2. “Mathematical Foundations of Computer Science” Chapter 5: Asymptotic Notation