I have a binary search tree, and I created a struct for the node that represents one element and the child to its left, yet, I cannot figure out the mechanism on how to check if it's a 2 node, with one element and two children or if it's 3 node, with two elements and three children. Would someone please give me a hint ?
This is my template class for the BNode
template<class E>
class BNode
{
public:
struct Entry
{
E value;
BNode* left;
};
bool IsThree();
private:
bool _three;
Entry _first, _second;
BNode* _right;
};
template<class E>
bool BNode<E>::IsThree()
{
//
}