help me in c++ binary tree i am not able to print tree
input:5 1 L 2 R 3 LL 4 LR 5 NOTE:LL mean left of root->left code: #include <iostream> using namespace std; struct node{ int data; node *left; node *right; }; node* create(int data){ node *temp=new node(); temp->data=data; temp->left=NULL; temp->right=NULL; return temp; } void print(node *root){ if(root=NULL) return; cout<<root->data<<endl; print(root->left); print(root->right); } int main() { int n,r; cin>>n>>r; string s;int a; node* root=create(r); int t=n-1; while(t--) { cin>>s>>a; node *temp=root; for(int i=0;i<s.length();i++){ if(s[i]=='L') { if(temp->left==NULL) temp=create(a); else temp=temp->left; } else { if(temp->right==NULL) temp=create(a); else temp=temp->right; } //cout<<temp->data<<" "; } delete(temp); } print(root); }