Hello everyone.
I just noticed that CF1648E has an easier approach , using Boruvka's algorithm.
Can anyone prove that the run time of this algorithm is O(ElogV)?
Thanks for reading!
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 155 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | djm03178 | 152 |
Hello everyone.
I just noticed that CF1648E has an easier approach , using Boruvka's algorithm.
Can anyone prove that the run time of this algorithm is O(ElogV)?
Thanks for reading!
Название |
---|
Auto comment: topic has been updated by EVENBAO (previous revision, new revision, compare).
I think the algorithm is somewhat self-explanatory about the log factor. But if it's not, then here is my explanation.
The log factor in the algorithm is the number of iteration. TL;DR: the number of components reduced by at least two after each iteration, hence the number of iterations.
Let's see the best case and the worse case. Let $$$opt(u)$$$ be the component that the optimal edge of the component $$$u$$$ connect to. This value act like a link, so for convenience, let's use that name. Now we find the number $$$cnt$$$, which is the of component $$$u$$$ such that $$$opt(opt(u)) \ne u$$$, that is, the component that $$$u$$$ is linking to is not link to $$$v$$$. In the optimal case, $$$cnt = 2$$$, meaning only two such components, so the links effectively form a tree. Therefore, in the best case, the number of iteration is $$$1$$$. The worse case is the reverse, $$$cnt \approx n$$$, meaning each new component will consist of two old components. But that is the point, in the worst case, the number of component is reduced by two, therefore we need about $$$\log n$$$ iterations.
Thanks for your help! well , I think I asked a dumb question lol.