балансировка

Balancing a binary tree

You need to balance the binary tree without using the height field for the element. I see this algorithm so that after each i ... d be very grateful if you can help with the code. P. s I know it's time-inefficient, but that's exactly what the problem is.