ProAlgos / ProAlgos-Cpp

C++ implementations of well-known (and some rare) algorithms, while following good software development practices
MIT License
513 stars 363 forks source link

AVL Tree Implementation #459

Open srsonia2506 opened 7 months ago

jsjeon-um commented 7 months ago

I'll work on this if thats alright

VagelisKitsios commented 1 month ago

Hello, I was taking a look at this when I ran into the following technical issue.

The AVL tree should logically be a subclass of the binary search tree as they share common operations (search, traversals). However, this is not possible because the AVL tree's nodes are fundamentally different from the ones used in the basic BST (they need an extra field to store the height of the node).

So my question is this:

Should I implement the AVL tree as a subclass of the binary search tree (changes would need to be made in the file binary_search_tree.hpp) or as a standalone class?