Модуль: Calculation of asymptotic complexity


Задача

7/9

Calculation of asymptotics - 7

Задача

For the code below, find the asymptotics:
void f(vector arr) { intn = arr.size(); vectord; for (int i = 0; i < n; i++) { int cnt = 0; for(int j=1;j*j <=arr[i];j++) if (arr[i] % j == 0) { cnt++; if (arr[i] / j != j) cnt++; } d.push_back(cnt); } for (int i = 0; i < d.size(); i++) cout << d[i] << ' '; }
Given that the elements of the array arr do not exceed C

1) O(nC)
2) O(n*sqrt(C))
3) O(n*sqrt(n))
4) O(C*sqrt(n))

Выберите правильный ответ, либо введите его в поле ввода

Комментарий учителя