证明或反驳 n^2 - n + 2 ∈在)
在我的算法分析课程中,我从算法中导出了函数 f(n) = n^2 - n + 2。现在我需要证明或反证 f(n) ∈ O(n)。显然不是,所以我几个小时以来一直试图反驳这一点,但不知道该怎么做。
为了反驳它,我需要证明消极的一面:
∀M > 0, ∀N > 0, ∃n > N s.t. n^2 - n + 1 < M·n
我已经尝试过前后工作,但似乎无济于事。我还试图证明,与我的判断相反,f(n) ∈ O(n):
∃M > 0, ∃N > 0 s.t. ∀n > N, n^2 - n + 1 ≥ M·n
...但没有成功。我到底做错了什么?
For my algorithm analysis course, I've derived from an algorithm the function f(n) = n^2 - n + 2. Now I need to prove or disprove f(n) ∈ O(n). Obviously it's not, so I've been trying to disprove that for a few hours and can't figure out how to do it.
To disprove it, I need to prove the negative:
∀M > 0, ∀N > 0, ∃n > N s.t. n^2 - n + 1 < M·n
I've tried working backwards and forwards, but can't seem to get anywhere. I've also tried to prove that, against my judgment, f(n) ∈ O(n):
∃M > 0, ∃N > 0 s.t. ∀n > N, n^2 - n + 1 ≥ M·n
... with no success. What am I doing so horribly wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
已经有一段时间了,但至少不是大θ......
It's been a while, but at least it's not big-theta...
假设有一些C> 0且M> 0 使得对于所有 n > 0 M,
n^2 - n + 1 <= Cn 对于所有 n > M
除以 n
n - 1 + 1/n <= C,对于所有 n > M
且因此
对于所有 n > n-1 <= C M.
这是不可能的。
Assume there is some C> 0 and M > 0 such that for all n > M,
n^2 - n + 1 <= Cn for all n > M
Divide by n
n - 1 + 1/n <= C for all n > M
and so
n-1 <= C for all n > M.
which is not possible.
反证法又如何呢?设置你的一般情况,以便你试图证明它是正确的,然后通过在每种情况下都必须是错误的陈述,那么整个证明必须是错误的。
What about a proof by contradiction. Set up your general cases such that you are trying to show it is true, and then by an statement which must be false in each case, then the whole proof must be false.