### red_coder's blog

By red_coder, 9 years ago, guys can u suggest me the different maximum values of N so that my program runs in time limit of 2 second for different complexities!!! Like if my complexity is O(N) then whats the maximum N for which my program would run in 2 second time limit? Similarly please also tell maximum N for O(N^2), O(N^3), O(logN), O(N*logN), O(2^N), ......etc. Comments (11)
 » 9 years ago, # | ← Rev. 3 →   Ordinary computer processes about 10^8-10^9 operations per second. Codeforces machines are fast, so this number is about 10^9. You can easyly calculate expected value of N. But answer to your question depends on constant in your algorithm. So, n2 = O(n2) and 1000000000 * n2 = O(n2), but second number is much more.
•  » » 9 years ago, # ^ | ← Rev. 2 →   I guess codeforces machines are really fast, as my solution of Problem B in last contest will run in O(2 * 10^8) = ( 20 * 1000 * 1000 * 9 ) in worst case and it passed system test in 0.220 sec!! here is the link
 » 9 years ago, # | ← Rev. 3 →   O(N) – 108O(N2) – 104O(N3) – 200O(logN) –  very big numberO(2N) – 24 UPD: Of course, it depends on constant, but in general it is not so high
•  » » 100002 = 10820003 = 8 * 109224 = 1.6 * 107 + epsVery strange numbers =)
•  » » » Exactly, I added extra ZERO to 200
•  » » » great observation dude ;)
•  » » Umm.. so, could anyone tell me what the time complexity for O(10^12), is??
•  » » » sqrt(N)
 » thanks friends for ur lovely answer
 » 9 years ago, # | ← Rev. 4 →   The answers posted above are for C and c++..For java , the value of N should be somewhere near 2*n^7 for O(N) solutions..Similarly adjust for other time complexities..It also depends on constant values and what data types u use..For eg.look at my solution for #128 Problem C..Using Strings 1860609 getting TLE and same solution using StringBuilder 1860654 getting accepted ..And ofcourse at the end of the day it also depends on the hardware configurations ..So for codechef which runs on Pentium III you decrease the value :(
 »