Feedback for subjective question
Question 1: Following is the while loop used in level-order traversal:
while(!q.empty()) {
treeNode = q.dequeue();
cout << *(treeNode->getInfo()) << " ";
if(treeNode->getLeft() != NULL )
q.enque( treeNode->getLeft());
if(treeNode->getRight() != NULL )
}
while(!q.empty()) {
treeNode = q.dequeue();
cout << *(treeNode->getInfo()) << " ";
if(treeNode->getLeft() != NULL )
q.enque( treeNode->getLeft());
if(treeNode->getRight() != NULL )
}
Current Answer:
Be the first to post an answer to earn 100CR.