We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Apply
  • Hiring developers?
  1. Prepare
  2. Data Structures
  3. Trees
  4. Tree: Preorder Traversal
  5. Discussions

Tree: Preorder Traversal

Problem
Submissions
Leaderboard
Discussions
Editorial

    You are viewing a single comment's thread. Return to all comments →

  • awittscience
    7 months ago+ 0 comments

    Basic recursive approach in C

    void preOrder( struct node *root) {
        if (root != NULL) {
            printf("%d ", root->data);
            preOrder(root->left);
            preOrder(root->right);
        }
    }
    
    0|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy