protected Node < K , V > unlinkAndUnionChildren ( Node < K , V > n ) { // disconnect children Node < K , V > child1 = n . o_c ; if ( child1 == null ) { return null ; } n . o_c = null ; Node < K , V > child2 = child1 . y_s ; if ( child2 == n ) { child2 = null ; } else { child2 . y_s = null ; } child1 . y_s = null ; if ( comparator == null ) { return union ( child1 , child2 ) ; } else { return unionWithComparator ( child1 , child2 ) ; } }
Unlink the two children of a node and union them forming a new tree .