fork download
  1. #include <iostream>
  2. using namespace std;
  3. void LevelOrderTraverse(node * root)
  4. {
  5. if(root == NULL)
  6. return;
  7. queue<node*> qTree ;
  8. qTree.push(root);
  9.  
  10. while(qTree.size() > 0)
  11. {
  12. node * prevNode = NULL ;
  13. int nSize = qTree.size();
  14. for(int nIndex = 0 ; nIndex < nSize ; nIndex++)
  15. {
  16. node* temp= qTree.front();
  17. qTree.pop();
  18.  
  19. if(!temp) continue;
  20. if(prevNode) { prevNode->nextRight = temp; }
  21. prevNode = temp ;
  22. if(temp->left)
  23. qTree.push(temp->left);
  24. if(temp->right)
  25. qTree.push(temp->right);
  26. }
  27. }
  28. }
  29.  
  30. int main() {
  31. // your code goes here
  32. return 0;
  33. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:3:25: error: variable or field ‘LevelOrderTraverse’ declared void
 void LevelOrderTraverse(node * root)
                         ^
prog.cpp:3:25: error: ‘node’ was not declared in this scope
prog.cpp:3:32: error: ‘root’ was not declared in this scope
 void LevelOrderTraverse(node * root)
                                ^
stdout
Standard output is empty