Trees -- Find sum at level K

why my code is not working properly plz explain also how to correct it here is the link,

Ayush, you need to edit your buildtree function, plz use the recursive approach for that, as
if(n==0)
return root ;
if(n==1)
root->left = buildTreeGeneric(root->left);
return root ;
else
root->left = buildTreeGeneric(root->left);
root->right = buildTreeGeneric(root->right) ;
return root ;

Try using this approach for building the tree.