Can somebody help me in finding running time of algo: Partitions the problem into two sub-problems of sizes n/5 and 7n/10, and spends O(n/log n) time to divide and combine the solutions.
№ | Пользователь | Рейтинг |
---|---|---|
1 | jiangly | 3976 |
2 | tourist | 3815 |
3 | jqdai0815 | 3682 |
4 | ksun48 | 3614 |
5 | orzdevinwang | 3526 |
6 | ecnerwala | 3514 |
7 | Benq | 3482 |
8 | hos.lyric | 3382 |
9 | gamegame | 3374 |
10 | heuristica | 3357 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 169 |
2 | -is-this-fft- | 165 |
3 | Um_nik | 161 |
3 | atcoder_official | 161 |
5 | djm03178 | 157 |
6 | Dominater069 | 156 |
7 | adamant | 154 |
8 | luogu_official | 152 |
9 | awoo | 151 |
10 | TheScrasse | 147 |
Can somebody help me in finding running time of algo: Partitions the problem into two sub-problems of sizes n/5 and 7n/10, and spends O(n/log n) time to divide and combine the solutions.
Название |
---|
We denote running time by T(n). Then
T(n)<=T(n/5)+T(7n/10)+an/log(n)
, where a is constant. Obviously, if running time of combining is asymptotically exactly O(n/log n), then T(n) cannot be less. So if we want to prove that T(n)=O(n/log n), then it is sufficient to prove that for some constant c:T(n)<=cn/log n
. Let's try to do this by induction.We can prove the base of induction for arbitrary large N: if we pick c big enough, we will have
T(n)<=cn/log n
for all n <= N. So the most interesting part is step. Here we haveWe see that
log(n/5)=log(n)-log(5)
, and so the first summand in the brackets tends to 1/5 when n tends to infinity; similarly, the second summand tends to 7/10. So we can choose N in such a way that for n>=N first summand is not greater than, say, 1/5+1/100, and second is not greater than 7/10+1/100. Then we can choose c big enough to prove induction base for n<=N and to make a/c less than 1/10-2/100. Therefore we obtain that the expression in brackets is not greater than 1, so we proved the induction step (we used the induction assumption for n/5 and 7n/10). The answer isO(n/log n)
Use Latex to format equations, i.e. put the formulas inbetween dollar signs: