Есть ли здесь ошибки?
template <typename T>
struct Node
{
	Node<T>* left_child{};
	Node<T>* right_child{};
	T value{};
};

template <typename KeyType, typename ValueType>
struct AA_node
{
	KeyType key{};
	ValueType value{};
	AA_node<KeyType, ValueType>* left{};
	AA_node<KeyType, ValueType>* right{};

	AA_node(KeyType k, ValueType v) : key(k), value(v), left(nullptr), right(nullptr) {}
};


template <typename KeyType, typename ValueType>
class PersistentAssociativeArray
{
private:
	AA_node<KeyType, ValueType>* base{};
	std::vector<Node<ValueType>*> versions{};
	std::vector<Node<KeyType>*> key_versions{};
	std::vector<KeyType> keys{};
	std::vector<std::pair<int, int>> parent_children_relation{};

	template <typename X>
	void buildTree(Node<X>*, AA_node<KeyType, ValueType>*, int, int);
	void buildTreeValue(Node<ValueType>*, AA_node<KeyType, ValueType>*, int, int);
	void buildTreeKey(Node<KeyType>*, AA_node<KeyType, ValueType>*, int, int);
	template <typename X>
	void add(Node<X>*, Node<X>*, int, int, int, X);
	void addValue(Node<ValueType>*, Node<ValueType>*, int, int, int, ValueType);
	void addKey(Node<KeyType>*, Node<KeyType>*, int, int, int, KeyType);
	template <typename X>
	X get(Node<X>*, int, int, int);
	ValueType getValue(Node<ValueType>*, int, int, int);
	KeyType getKey(Node<KeyType>*, int, int, int);
	int countLeaves(Node<ValueType>* _node);
	AA_node<KeyType, ValueType>* insertRecursive(AA_node<KeyType, ValueType>*, KeyType, ValueType);
	AA_node<KeyType, ValueType>* searchRecursive(AA_node<KeyType, ValueType>*, KeyType);
	void inorderRecursive(AA_node<KeyType, ValueType>*);
	int sizeRecursive(AA_node<KeyType, ValueType>*);
	void printSliceRecursive(AA_node<KeyType, ValueType>*, int, int);

public:
	PersistentAssociativeArray(AA_node<KeyType, ValueType>*);
	PersistentAssociativeArray(KeyType, ValueType);
	PersistentAssociativeArray(ValueType*, int);
	~PersistentAssociativeArray();

	void setElementToBase(KeyType, ValueType);
	ValueType getElement(AA_node<KeyType, ValueType>*, KeyType);
	ValueType getElementByIndex(AA_node<KeyType, ValueType>*, int);
	void addVersion(int, int, ValueType);
	void printInorder(AA_node<KeyType, ValueType>*);
	void printSlice(AA_node<KeyType, ValueType>*, int, int);
	void printAllVersions();
	void changeVersion(int, int, ValueType);
	int versionSize(int);
	int getSize(AA_node<KeyType, ValueType>*);
	AA_node<KeyType, ValueType>* getAssociativeArray(int);
	void deleteElement(int, int);
	void insertElement(int, int, KeyType, ValueType);
	void printKeys();

};



template<typename KeyType, typename ValueType>
template<typename X>
inline void PersistentAssociativeArray<KeyType, ValueType>::buildTree(Node<X>* _node, AA_node<KeyType, ValueType>* _root, int _left, int _right)
{
	//std::cout << "\nin build with: l = " << _left << " r = " << _right << "\n";
	//printSlice(_root, _left, _right);

	if (_left == _right)
	{
		_node->value = getElementByIndex(_root, (_left - 1));
		//std::cout << "in if\t" << _node->value << "\n";
	}
	else
	{
		int middle = (_left + _right) / 2; //std::cout << "m = " << middle << "\n";
		_node->left_child = new Node<X>(); //std::cout << "\nmaking left child";
		buildTree(_node->left_child, _root, _left, middle);
		_node->right_child = new  Node<X>(); //std::cout << "\nmaking right child";
		buildTree(_node->right_child, _root, middle + 1, _right);
	}
}
template<typename KeyType, typename ValueType>
inline void PersistentAssociativeArray<KeyType, ValueType>::buildTreeValue(Node<ValueType>* _node, AA_node<KeyType, ValueType>* _root, int _left, int _right)
{
	buildTree(_node, _root, _left, _right);
}

template<typename KeyType, typename ValueType>
inline void PersistentAssociativeArray<KeyType, ValueType>::buildTreeKey(Node<KeyType>* _node, AA_node<KeyType, ValueType>* _root, int _left, int _right)
{
	buildTree(_node, _root, _left, _right);
}