UnionFind6

package
v0.0.0-...-adc727d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2020 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UnionFind6

type UnionFind6 struct {
	// contains filtered or unexported fields
}

rank[i]表示以i为根的集合所表示的树的层数 在后续的代码中, 我们并不会维护rank的语意, 也就是rank的值在路径压缩的过程中, 有可能不在是树的层数值 这也是我们的rank不叫height或者depth的原因, 他只是作为比较的一个标准

func Constructor

func Constructor(size int) *UnionFind6

构造函数

func (*UnionFind6) GetSize

func (this *UnionFind6) GetSize() int

func (*UnionFind6) IsConnected

func (this *UnionFind6) IsConnected(p int, q int) bool

查看元素p和元素q是否所属一个集合 O(h)复杂度, h为树的高度

func (*UnionFind6) UnionElements

func (this *UnionFind6) UnionElements(p int, q int)

合并元素p和元素q所属的集合 O(h)复杂度, h为树的高度

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL