AVL Balance Binary Search Tree in C++
Implementation of AVL Balance binary search tree in C++. Github: sourcecode/AVLbalancedtree.h #include <iostream> #include "queueusinglinkedlist.h" using namespace std; /* AVL balanced binary search tree class*/ template <typename T> class avlbalancedbst { private: /* node */ template <typename T>class Node { public: Node<T>* left; //left tree Node<T>* right; //right tree T data; //data int height; //height of the tree int bf; //balance factor //constructor Node<T>() :left(nullptr), right(nullptr) { } }; //root node Node<T>* root; public: //constructor avlbalancedbst() :root(nullptr) { } //add element void addrecursive(T elem) { //if the element is already found, return if (findelement(root, elem)) { return; } //add element root = addrecursive(root, elem); } //recursive call to add the element to the tree Node<T>* addrecursive(Node<T>* node, T elem) { //...