We have a class project to implement an AVL tree. Here are two very general implementations:
template<class T>
class AVLTree {
int key;
int height;
int BF;
T data;
AVLTree<T>* father, leftSon, rightSon;
.
.
.
}
A friend told me I really should use Nodes but he wasn't able to explain why. So here is the second implementation which I have seen in many places (using Node):
template<class T>
class AVLTree {
int key;
int height;
int BF;
T data;
Node* father, leftSon, rightSon;
class Node {
int key;
int height;
int BF;
T data;
Node* father, leftSon, rightSon;
}
.
.
.
}
What's really the difference? Is my implementation impossible in terms of the compiler?