复杂.为什么常量不重要? [英] Complexity. Why dont constants matter?

查看:67
本文介绍了复杂.为什么常量不重要?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能以一种简单的方式向我解释为什么常数对于大O表示法无关紧要吗?当添加常数时,为什么复杂度保持不变.这不是一个作业问题,我只是想更好地理解这一点.让我直说这个大O就是看函数接近无穷大时的行为吧?

Can someone please explain to me in a simple way why constants don't matter when it comes to big O notation? Why does the complexity stay the same when you add a constant. This is not a homework question I just want to understand this better. Let me get this straight big O is for seeing the behavior of a function as it approaches infinity right?

我明白了.非常感谢大家.

I got it. Thanks so much everyone.

推荐答案

复杂性理论并不重要,复杂度理论只对 感兴趣,因为函数随输入大小的增长而缩放.

It does not matter for complexity theory, which is interested only in how the function scales as the input size grows.

一个常量完全不会影响输入大小逐渐变为无穷大时函数的行为.

A constant does not affect how the function behaves as input sizes grow towards infinity at all.

但是,如果您对实际运行特定的代码感兴趣,那么您可能会对较大的常量开销以及该函数如何在较小的输入大小下执行感兴趣.

However, if you are interested in actually running a certain piece of code, you may very well be interested in a large constant overhead and how the function performs for smaller input sizes.

复杂性理论与实践之间的区别.

Difference between complexity theory and practice.

这篇关于复杂.为什么常量不重要?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆