计算机科学中的Big-O符号有什么大不了的? [英] What is the big deal about Big-O notation in computer science?

查看:103
本文介绍了计算机科学中的Big-O符号有什么大不了的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Big-O表示法对我日常的C#编程有何帮助?这只是学术活动吗?

解决方案

Big-O从输入量的角度告诉您算法的复杂性.如果您想知道算法如何扩展,这是基本.如果您正在设计一个大型网站并且您有很多用户,那么处理这些请求所花费的时间就很重要.如果您有大量数据,并且想要将其存储在结构中,那么如果要编写不需要一百万年才能运行的内容,则需要知道如何有效地进行操作.

不是Big-O表示法本身会为您提供帮助.就是说,如果您了解Big-O表示法,便会了解算法的最坏情况下的复杂性.本质上,Big-O可以让您从高层次上了解哪些算法快速,哪些算法较慢以及权衡取舍.如果您不了解,那么我看不到如何理解.NET集合库中任何内容的性能含义.

由于这里的问题已经很多次了,但在这里我将不做详细介绍,但足够了说这是您应该理解的.这是一个投票率很高的>之前的Big-O问题,可以帮助您入门./p>

How would Big-O notation help in my day-to-day C# programming? Is it just an academic exercise?

解决方案

Big-O tells you the complexity of an algorithm in terms of the size of its inputs. This is essential if you want to know how algorithms will scale. If you're designing a big website and you have a lot of users, the time it takes you to handle those requests is important. If you have lots of data and you want to store it in a structure, you need to know how to do that efficiently if you're going to write something that doesn't take a million years to run.

It's not that Big-O notation itself will help you. It's that if you understand Big-O notation, you understand the worst-case complexity of algorithms. Essentially, Big-O gives you a high-level sense of which algorithms are fast, which are slow, and what the tradeoffs are. I don't see how you can understand the performance implications of anything in, say, the .NET collections library if you don't understand this.

I won't go into more detail here, since this question has been asked many times, but suffice it to say that this is something you should understand. Here's a fairly highly voted previous Big-O question to get you started.

这篇关于计算机科学中的Big-O符号有什么大不了的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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