Модуль: Calculation of asymptotic complexity


Задача

6/9

Calculation of asymptotics - 6

Задача

For the code below, find the asymptotics: string a, b; cin>> a>> b; int n = a.size(), m = b.size(); int count = 0; for (int i = 0; i + m <= n; i++) { string s = a.substr(i, m); if (s == b) count++; }
1) O(n)
2) O(n+m)
3) O(n^2)
4) O(nm) 

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

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