简体   繁体   English

带路径压缩的加权快速联合。 深度如何达到4?

[英]Weighted Quick-Union with Path Compression. How can depth of 4 can be achieved?

I am trying to achieve a depth of 4 applying Weighted Quick-Union with Path Compression. 我正在尝试通过路径压缩应用加权快速联合达到4的深度。 Can you please help how to simulate it. 您能帮忙如何模拟它吗? I meant to ask sequence of union operations that that may result in depth of 4. 我的意思是要询问可能导致深度为4的并集操作顺序。

As a hint, start with 32 elements. 提示一下,从32个元素开始。 What happens if you pairwise link the elements, then pairwise link the roots of those new trees, then pairwise link the roots of those trees, etc.? 如果成对链接元素,然后成对链接这些新树的根,然后成对链接那些树的根,等等,会发生什么? I'll leave the rest of the details as an exercise, since this looks like a homework question. 我将其余的细节留作练习,因为这看起来像是一个作业问题。

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM