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.
You can consider it O(1):
source: c# Math.Sqrt Implementation