union_find_test

  • 2022-12-14
  • 浏览 (322)

union_find_test.go 源码

package disjointset

import (
	"testing"
)

func TestDisjointSet(t *testing.T) {

	u := NewUnionFind(10)
	r := u.Find(3)
	t.Log(r)
	t.Log(u.Find(2))

	t.Log(u.count)

	t.Log("-------------")
	u.Union(1, 5)
	t.Log(u.Find(1))
	t.Log(u.Find(5))
	t.Log(u.count)
}

你可能感兴趣的文章

union_find

0  赞