Hey, the time complexity here is n^2 . Can someone explain why and how to calculate it? Thanks in advance.
Code:void f(int n) { for (int i=1; i<=n; i++) for (int j=1; j<=n*n/i; j+=i) printf(“*”); }
Hey, the time complexity here is n^2 . Can someone explain why and how to calculate it? Thanks in advance.
Code:void f(int n) { for (int i=1; i<=n; i++) for (int j=1; j<=n*n/i; j+=i) printf(“*”); }