Making binary tree

in this code im only making and printing binary tree, im not calculating sum here, only making the tree, can you please rectify and tell me the error why output is not printing.

@akshatkaush
hello Akshat,
u are handling case when child=1 in ur build function

let alone case when child==1, for child =2 and 0 it should work. Given input is having child=0 or 2 only.

@akshatkaush
sorry didnt get what u r saying

no of child can be 1 as well. in question it is mentioned that no of child will not exceed 2


please check it now…

now it is almost correct.
i have made some changes pls check->

thank you for the solution but can you explain why you added NULL at the end of the function

@akshatkaush
that return statement will never execute.

i put it there because without that statement compiler will think that we are not returning anything and will raise compile error