Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: