fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. struct Node {
  5. int data;
  6. Node* left;
  7. Node* right;
  8. Node(int val) {
  9. data = val;
  10. left = right = NULL;
  11. }
  12. };
  13.  
  14. // Example construction
  15. int main() {
  16. Node* root = new Node(1); // Root
  17. root->left = new Node(2); // Left child of root
  18. root->right = new Node(3); // Right child of root
  19. root->left->left = new Node(4); // Left child of 2
  20. root->left->right = new Node(5); // Right child of 2
  21.  
  22. // এখন Tree structure:
  23. // 1
  24. // / \
  25.   // 2 3
  26. // / \
  27.   // 4 5
  28. }
  29.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
Standard output is empty