How can I find the complexity of this function?
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);
}
I know that the below section is 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]);
But I can't figure out what the complexity of Math.Sqrt()
is.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…