public void MakeSet(int _Data) { var node = new DSNode { Data = _Data, Rank = 0 }; node.Parent = node; collection.Add(_Data, node); }
public DSNode FindSet(DSNode node) { if (node.Parent == node) { return(node); } var parent = FindSet(node.Parent); node.Parent = parent; return(parent); }