in the code of recursive level order print,
void print_kth_level(node*root,int k)
{
if(root==NULL)
{
return;
}
if(k==1)
{
cout<data<<" ";
return;
}
print_kth_level(root->left,--k);
print_kth_level(root->right,--k);
return;
}
this gives wrong output. what is the reason behind this?