Create tree problem

sir here i am getting segmentation problem.

I have made some corrections. Still there are some issues with your code.
Check your BFS function.