Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

render_example_test.gno

0.71 Kb · 30 lines
 1package disjointsetdemo
 2
 3// ExampleRender pins the realm's Render output as a testable example.
 4func ExampleRender() {
 5	print(Render(""))
 6	// Output:
 7	// # Union-Find
 8	//
 9	// Disjoint-set forest with path compression and union by rank, demoing the [`p/moul/x/daily/disjointset`](/p/moul/x/daily/disjointset/v0) library.
10	//
11	// ## Merges applied
12	//
13	// - `Union(0, 1)`
14	// - `Union(2, 3)`
15	// - `Union(1, 3)`
16	// - `Union(5, 6)`
17	// - `Union(7, 8)`
18	// - `Union(8, 9)`
19	//
20	// ## Partition of [0, 10)
21	//
22	// **4** groups:
23	//
24	// - `{0, 1, 2, 3}`
25	// - `{4}`
26	// - `{5, 6}`
27	// - `{7, 8, 9}`
28	//
29	// > Groups come out sorted, ordered by their smallest member, so the partition is identical whatever order the merges arrive in.
30}