I have a TREE class like this.
class tree
{
public:
struct node *root;
struct node *head;
tree()
{
root=NULL;
head=NULL;
}
void insert(int num);
void inorder(node *temp);
int depth(node *temp);
void preorder(node *temp);
int count(node *temp);
void tree_dll();
void append_beg(struct node* temp);
void append_end(struct node* temp);
int level( struct node *temp, struct node *k, int lev);
node* search(node *temp,int num);
};
However I want to create functions (like inorder and preorder) with
default argument as the root of the tree so that the call to them
becomes cleaner from the main function. As I want to call the inorder
traversal of a tree I want to make a call as T.inorder() rather than
T.inorder(T.head) but the argument needs to be sent as the function is
recursive. I guess my question is clear.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.