class union_find n = object(self) val father = Array.make n -1 val count = Array.make n 1 method find i = if father.(i) = -1 then i else self#find(father.(i)) method union i j = let i0 = self#find i in let j0 = self#find j in if i0 <> j0 then begin .... end end;;