runtime - What is the bounding function (Big-O) of the number of times the indicated line is run? (C) -


i'm trying grasp concept of runtime , im bit confused on problem. know runtime of outer loop o(n). know values of n greater 1000, inner loop run in constant time. however, values of n < 1000, inner loop appears have logarithmic runtime. mean big o of function o(n log n) since i'm supposed assume worst case scenario?

for(i = 1; < n; i++) {   for(j = 1000/i; j > 0; j--) {      arr[j]++;     <-------- line      }  }  

big o notation describes behavior n approaches infinity.
a=o(b) , b functions of n, means limit of a/b when n approaches positive infinity smaller positive infinity.
cases under n=1000 don't affect big o notation.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -