I have two flared trees, $ A $ and $ B $.
When each element of $ A $ is smaller than each element of $ B $we can merge them $ O ( log N) $.
My question is; when all the elements of $ A $ are not necessarily smaller than all elements of $ B $, how can we still merge $ A $ and $ B $ in $ O ( log N) $?
What I have already tried:
Flare $ A $the biggest element of, splay $ B $The smallest element. The root $ R_A $ of $ A $ no longer have a righteous child, and the root $ R_B $ of $ B $ no longer has a left child. Compare $ R_A $ and $ R_B $. Yes $ R_B $ is taller than $ R_A $, make $ R_B $ the good child of $ R_A $, which fails when $ R_A $ is taller than $ R_B $.