create array union find algorithm