简体   繁体   English

大O表示法的图形

[英]Graphs for Big O notation

I wonder if there's any tool/website where I can plot some run times as graphs. 我想知道是否有任何工具/网站可以将一些运行时间绘制为图表。 Because, the asymptomatic notation is often not what I wanted ie Don't want to ignore constants. 因为,无症状符号通常不是我想要的,即不想忽略常量。

For example, suppose If I have two notations, like: 例如,假设如果我有两种表示法,例如:

1) O = (n* logn).
2) O = (n* logn * logn)/5.

It's obvious that 1st one is asymptotically better. 显然,第一个渐近地更好。 But what I want to see how they perform and at which point the second one starts to become better. 但是我想看一下它们的性能以及第二点开始变得更好。

A graphical notation where I can enter different equations and plot them them to see how they vary would be greatly useful for this purpose. 我可以通过图形表示法输入不同的方程式并将它们绘制成图表,以查看它们如何变化,这将非常有用。 In my search I found this site where they have some plots. 在我的搜索中,我发现了这个站点 ,那里有一些地块。 I am looking for something similar but I also want to input my equations to plot to analyse the performance for various 'n' values. 我正在寻找类似的东西,但我也想输入方程式进行绘图,以分析各种'n'值的性能。

As soon as you stop "ignoring constants", you're no longer graphing "Big O" notation, but just performing a standard XY plot. 一旦停止“忽略常量”,您就不再在绘制“ Big O”符号,而只是执行标准的XY绘图。 As such, any graphing program, even online graphing calculators , would let you display this, just replace "n" for "X" and you'll get the proper graph. 这样,任何制图程序,甚至是在线制图计算器 ,都可以让您显示该图形 ,只需将“ n”替换为“ X”,您将获得正确的图形。

Would this or this help? 这个这个有帮助吗?

If you use a 3d grapher, you can use the other dimension (say y ) as a constant replacement. 如果使用3D绘图仪,则可以使用其他尺寸(例如y )作为常量替换。 This way you would be able to interpret results as: 这样,您就可以将结果解释为:

when y is greater than 5, n*log(n)*log(n)/y is better than n*log(n) starting from n = (actual value) 当y大于5时,n * log(n)* log(n)/ y优于n * log(n),从n =(实际值)开始

Also, you can ignore the 3rd dimension. 另外,您可以忽略第三维。 Or use it if you have a complexity depending on 2 variables. 如果您的复杂度取决于2个变量,也可以使用它。

Just input the difference between the complexities. 只需输入复杂性之间的差异即可。 In this case, ignoring the 3rd dimension and considering log(x) = ln(x) , the equation is: 在这种情况下,忽略第三维,并考虑log(x)= ln(x) ,公式为:

z = x*ln(x) - x*ln(x)*ln(x)/5 z = x * ln(x)-x * ln(x)* ln(x)/ 5

An you can interpret that as x*ln(x) is more efficient when z is negative. 您可以将其解释为x * ln(x)z为负数时效率更高。

If you want to see how they perform then you have to implement the algorithms and execute them on various graph. 如果要查看它们的性能,则必须实现算法并在各种图形上执行它们。 Modern processors with memory locality and cache misses make it really hard to come up with an equation that gives you a reasonable estimation. 具有内存局部性和高速缓存未命中的现代处理器使要提出合理估算的方程式变得非常困难。

I can guarantee you that oyu won't measure what you would expect. 我可以向您保证oyu不会衡量您的期望。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM