Home > Back-end >  Ask the time complexity of this code
Ask the time complexity of this code

Time:09-27

 
for(int i=1; iFor (int j=0; JThe function ();


Trouble concise process is given

CodePudding user response:

Two loops, it should be O (n ^ 2)

CodePudding user response:

reference 1st floor u010165006 response:
two loops, it should be O (n ^ 2)

Two layers of circulation

CodePudding user response:

Should is o (n), although it is two layers of circulation, but the function () the number is 1 + 2 + 4 + 8...
  • Related