5 ms·
That doesn't sound like "inverting". If that is what it means then it is indeed a bad name. I always thought it means making one of the leaf nodes a root of th
by balfirevic 8y ago
That doesn't sound like "inverting". If that is what it means then it is indeed a bad name.
I always thought it means making one of the leaf nodes a root of the tree. Physically, it would look like taking one of the leaf nodes with your fingers and "hanging" the tree off of it.
- BearOso 8y agoInverting 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.
- boomlinde 8y agoinvert: to reverse in position, order, or relationship