union find algorithm

added an union find algorithm ( nicely documented)