MCPcopy Create free account
hub / github.com/Ayush7614/Daily-Coding-DS-ALGO-Practice / preorder

Function preorder

Leetcode/C++/Invert binary tree.cpp:30–39  ·  view source on GitHub ↗

Function to perform preorder traversal on a given binary tree

Source from the content-addressed store, hash-verified

28
29// Function to perform preorder traversal on a given binary tree
30void preorder(Node* root)
31{
32 if (root == nullptr) {
33 return;
34 }
35
36 cout << root->data << " ";
37 preorder(root->left);
38 preorder(root->right);
39}
40
41// Function to invert a given binary tree using preorder traversal
42 void swap(TreeNode* root)

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected