Time Complexity Analysis
General TC
Harmonic Sum Analysis
When a function goes in the form of
for(int i=1;i<=n;++i)
{
for(int j=2*i;j<=n;j+=i)
cout<<(i,j);
}
The Summation part takes O(logN) hence the total time is O(N*logN)
Note: Find Why it is logN
comments powered by Disqus