Tree: Preorder Traversal

Sort by

recency

|

82 Discussions

|

  • + 0 comments

    Why is this considered an advanced level challenge?

    I'm not even sure what the challenge was supposed to be. It felt more like a introduction to trees tutorial question.

  • + 0 comments

    Why is the php so messed up? why doesn't it make sense compared to python and js ?

  • + 0 comments
    void preOrder(Node *root) {
    
                if (root == nullptr){
                return;
        }
    
        std::cout << root->data << " ";
        preOrder(root->left);
        preOrder(root->right);}
    
    }
    
  • + 0 comments

    Why is the C++ 14 solution template formulated in such a weird way that you cannot include additional libraries (such as stack for this question)? The C++ 11 and 20 templates are totally fine. I wish the solution templates are all standardized like Leetcode does.

  • + 0 comments
    if(root == nullptr)
              return;
               
    int data = root->data;
    cout<<data <<  " ";
    preOrder(root->left);
    preOrder(root->right);