what is complexity of following code and why? -


number of divisor using prime factorization. code:

include

using namespace std;

vector<int> primes; // we'll preload primes once @ beginning int countdivisor(int n) {   int divisor = 1;   (int = 0; < primes.size(); i++) {     if (n % primes[i] == 0) {       int cnt = 1;       while (n % primes[i] == 0) {         n /= primes[i];         cnt++;       }       divisor *= cnt;     }   }   return divisor; } 


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -