the input is only a stream of integers which represent the level order traversal of a tree . when -1 is given as input then the corresponding node is null .
i used a queue of node* but I cannot understand why there is a seg fault.
Getting segmentation fault for building a tree from it's level order traversal
@015itachiuchiha
Change line 16 to while(!q.empty() && q.front()->data== -1){q.pop();}
If your queue is empty, it doesn’t have q.front(). That’s why it’s giving segmentation fault.