相关疑难解决方法(0)

Math.Sqrt()的时间复杂度?

我怎样才能找到这个功能的复杂性?

private double EuclideanDistance(MFCC.MFCCFrame vec1, MFCC.MFCCFrame vec2)
{
  double Distance = 0.0;
  for (int K = 0; K < 13; K++)
     Distance += (vec1.Features[K] - vec2.Features[K]) * (vec1.Features[K] - vec2.Features[K]);
  return Math.Sqrt(Distance);
}
Run Code Online (Sandbox Code Playgroud)

我知道下面的部分是O(1):

double Distance = 0.0;
for (int K = 0; K < 13; K++)
   Distance += (vec1.Features[K]-vec2.Features[K])*(vec1.Features[K]-vec2.Features[K]);
Run Code Online (Sandbox Code Playgroud)

但我无法弄清楚复杂性Math.Sqrt()是什么.

c# big-o time-complexity math.sqrt

7
推荐指数
2
解决办法
1227
查看次数

标签 统计

big-o ×1

c# ×1

math.sqrt ×1

time-complexity ×1