What about t.unite(1, 1) ? Is that not allowed? ]]>

member t.unite(p, q) =

let i = root(p)

let j = root(q)

if sz.[i] < sz.[j] then

id.[i] <- j; sz.[j] sz.[j] then

id.[j] <- i; sz.[i] <- sz.[i] + sz.[j]

else

id.[i] <- j; sz.[j] <- sz.[j] + 1 ]]>

Weighted Quick-Union with Path Compression on F# Snippets has an error. The “sz” array is always filled with zerros.

]]>