DEV Community

IvanGroz
IvanGroz

Posted on

RBST.Randomized Binary Search Tree. Cannot insert into the root

I don't quite understand how to check the insertion into the root of the tree with left or right rotation. The functions themselves work fine, but the tree doesn't change From RBSTree.h:

Collection<K,T>::Node* insert(Collection<K,T>::Node*& rootF, K key, T value) {
        srand((int)time(0));
        if (rootF == nullptr) {
            return new typename Collection<K,

Top comments (0)