Tree right view


I am not able to pass all testcases

Chirag, pls use the following approach for printing right view of tree as ,

void rightutil(node *root,int level,int *max_level)
{
if(root==NULL)
{
return;
}
if(*max_level<level)
{
cout<data<<" ";
*max_level=level;
}
rightutil(root->right,level+1,max_level);
rightutil(root->left,level+1,max_level);
}
void rightview(node *root)
{
int max_level=0;
rightutil(root,1,&max_level);
}