You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to have some Binary search trees (BST) here.
At the moment, I know how they work and how to implement AVL and Treaps. And maybe this is the time to learn about other BSTs to implement them as well XD.
First, on functionalities, I can think of all the standard $\mathcal{O}(\log n)$ BST operations (inserting, erasing, finding, counting how many are less than something, finding the kth element, etc). What other functionalities do you think we should add?
These BST can then be used to implement tree-based maps and sets. I can also think of allowing range operations, with lazy updates (standard competitive programming stuff). But maybe we should think about this after the first implementation.
About abstraction, because different BSTs work quite differently, I don't see a clear way of abstracting the BST class.
I do think a tree-based set/map implementation can be abstracted so that we could use any type of BST.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
It would be nice to have some Binary search trees (BST) here.
At the moment, I know how they work and how to implement AVL and Treaps. And maybe this is the time to learn about other BSTs to implement them as well XD.
First, on functionalities, I can think of all the standard$\mathcal{O}(\log n)$ BST operations (inserting, erasing, finding, counting how many are less than something, finding the kth element, etc). What other functionalities do you think we should add?
These BST can then be used to implement tree-based maps and sets. I can also think of allowing range operations, with lazy updates (standard competitive programming stuff). But maybe we should think about this after the first implementation.
About abstraction, because different BSTs work quite differently, I don't see a clear way of abstracting the BST class.
I do think a tree-based set/map implementation can be abstracted so that we could use any type of BST.
Beta Was this translation helpful? Give feedback.
All reactions