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 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
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: