Creating Trees

PHOTO EMBED

Sun Jun 05 2022 06:42:52 GMT+0000 (Coordinated Universal Time)

Saved by @Ranjan_kumar #c++

#include <bits/stdc++.h>
using namespace std;
struct node{
   int data;
   struct node* left;
   struct node* right;
   node(int val)
   {
      data=val;
      left=right=NULL;
   }
};

int main()
{
struct node* root=new node(1);
root->left=new node(5);
root->right=new node(8);
root->left->right=new node(9);
cout<<root->left->right->data;
	return 0;
}
content_copyCOPY