|
|
|
|
|
by BearOso
2771 days ago
|
|
Inverting means inverting the sort order. The easy answer is to encapsulate the tree in a new structure and add a Boolean flag called “inverted,” since you’re just reinterpreting the meaning of left and right children. What you describe is called “rotation,” and is used to rebalance. |
|