Help about Binary Tree

I am struggling in writing a method to return the parent node of a given Tree node. The class of the Tree is following:

class BinaryTree {
private:
int data;
BinaryTree *left;
BinaryTree *right;
public:
BinaryTree(int i, BinaryTree *L, BinaryTree *R) {
data=i; left=L; right=R;
}
~BinaryTree() {}
int RootData() { return data; }
BinaryTree* Left() { return left; }
BinaryTree* Right() { return right;}
};

The problem is that I need to write a member function which takes a Tree Node argument and returns the parent node of that node.

Thanks very much!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories