if left and right subtrees are similar update maximum subtree if needed ( Note that left subtree may have a bigger value than right and vice versa )
int size = ls + rs + 1 ; if ( left . compare ( right ) == 0 ) { if ( size > maxSize ) { maxSize = size ; maxNode = root ; } }