What is the time complexity of the algorithm in the following code? it's best to explain the idea.

what is the time complexity of the algorithm in the following code? it"s best to explain the idea

.
i= s = 0;
while (s<n)
{
    iPP;
    s+=i;
}
Feb.19,2022

Let I just stop. From the summation formula, we get (0 + I) * (I + 1) / 2 > = n , retain the highest order I ^ 2 , and get O (sqrt (n)) time complexity.


violence (because I am lazy but diligent)

$cat complex.groovy

  

O (n ^ 1 / 2)

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35326-34324.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35326-34324.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?