Time complexity (in big-O notation) of the following code?

I was just wondering what is the time complexity of the following code.

The time complexity (Big O) of the code below in my opinion would be O(n^4)

What do you guys think?

int result = 0;
for(int i =1; i<n*n; i++){
  for (int j=i; j*j <n; j++){
    for(int k =j; k*k <n; k++){
      result++;
     }
  }
}

Answers


Looks like n^(2.75) to me:

- outer loop: n^2
- first inner loop is sqrt(n)
- second inner loop is sqrt(sqrt(n))

Total of:

n^2 * sqrt(n) *  sqrt(sqrt(n)) = n^(2+ 0.5 + 0.25) = n^(2.75)

Formal steps (need to be verified) using Sigma Notation would yield the following:


Need Your Help

Can't able to open collabnet merge wizard in eclipse

android merge client collabnet

I had installed "Collabnet Merge Client" in eclipse by the following link Subclipse 1.8.x Update Site - http://subclipse.tigris.org/update_1.8.x. By right clicking the project Team->Merge eclipse

Where to Manipulate Data Gotten via AJAX Service? Link fn or Controller?

javascript angularjs ajax model-view-controller

I have a HTML partial that I'm trying to bind AJAX data too. For some reason, it seems I must put the AJAX service call within the directive's link function. I cannot just put it in the controller;...