如何计算一个算法的运行时间?算法、时间

2023-09-12 23:35:13 作者:敢不敢以心换心 *

我读过有关算法的运行时间在某些算法的书,它是pssed作为前$ P $ O(N)。对于例如,给定code将运行在O为最好的情况和安培(n)的时间;为O(n 3 )为最坏的情况。这是什么意思&安培;一个人如何计算它自己的code?是不是像线性时间,并且是像每个predefined库函数都有自己的运行时,应牢记调用它之前?谢谢...

I've read about algorithm run-time in some algorithm books, where it's expressed as, O(n). For eg., the given code would run in O(n) time for the best case & O(n3) for the worst case. What does it mean & how does one calculate it for their own code? Is it like linear time , and is it like each predefined library function has their own run-time which should be kept in mind before calling it? Thanks...

推荐答案

一个初学者指南大O符号可能是一个良好的开端:

A Beginner's Guide to Big O Notation might be a good place to start:

的http://抢铃.NET / 2009/06 / A-新手引导到大O记法/

也看看维基百科

http://en.wikipedia.org/wiki/Big_O_notation

有计算器上的几个相关问题,并很好的答案

there are several related questions and good answers on stackoverflow

纯英文解释,大澳

大O的八岁儿童?