Find sum at level K

I cannot understand how to build binary tree for this particular given input:
1 2
2 2
3 0
4 0
5 2
6 0
7 0

Please help.

Here, in this question, you are supposed to build a generic tree, where first column value indicates your data values of nodes, and second value of the column indicates the no of children that data node has, 0 means no child, 1 means a left child and 2 means left as well as right child… you can use recursive approach to build the tree, as
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.