add test case for union find algorithm