# URI Online Judge Solution 1200 BST Operations I – Solution in C, C++, Java, Python and C#

### URI Online Judge Solution 1200 BST Operations I Tree Recovery  – Solution in C, C++, Java, Python and C#

URI Online Judge Solution 1200 BST Operations I   | Beginner

Problem Name: 1200 BST Operations I code
Problem Number : URI – 1200 BST Operations I solution
Online Judge : URI Online Judge Solution
Category: Beginner
Solution Language : C,C plus plus, java, python, c#(c sharp)

### URI Solution 1200 BST Operations I Simple Input output

 Sample Input Sample Output I cI fI aI hINFIXAPREFIXAPOSFIXAP zP hI gINFIXA a c f hc a f ha h f cz nao existeh existea c f g h

### URI Solution 1200 BST Operations I Code in C++ / URI 1200 in cpp:

``#include <iostream>#include <cstdio>#include <cstring>using namespace std;bool b; struct Node{ char data; Node* left; Node* right;}; Node* GetNewroot(int data){ Node* newroot = new Node(); newroot -> data = data; newroot -> left = NULL; newroot -> right = NULL; return newroot;} Node* Insert(Node* root, int data){ if(root == NULL){  root = GetNewroot(data);  return root; }else if(data <= root -> data){  root -> left = Insert(root -> left, data); }else{  root -> right = Insert(root -> right, data); }  return root;}bool lookup(struct Node* root, int target) {    if (root == NULL){   return false;    }else {   if (target == root->data){   return true;   }else{    if (target < root->data) return lookup(root->left, target);      else return lookup(root->right, target);   }    } }  void printPreOrder(struct Node* root) { if (root == NULL)   return; if(b){  printf("%c", root -> data);  b = false;  }else{  printf(" %c", root -> data); }  printPreOrder (root -> left);  printPreOrder (root -> right); } void printInOrder(struct Node* root) {  if (root == NULL)   return; printInOrder (root -> left);  if(b){  printf("%c", root -> data);  b = false;  }else{  printf(" %c", root -> data); } printInOrder (root -> right);} void printPosOrder(struct Node* root) {  if (root == NULL)   return; printPosOrder (root -> left);  printPosOrder (root -> right); if(b){  printf("%c", root -> data);  b = false;  }else{  printf(" %c", root -> data); }}   int main(int argc, char const *argv[]){ string s; Node* root = NULL; while(getline(cin, s)) {  if(s == "INFIXA"){   b = true;   printInOrder(root);   printf("n");  }else if(s == "PREFIXA"){   b = true;   printPreOrder(root);   printf("n");  }else if(s == "POSFIXA"){   b = true;   printPosOrder(root);   printf("n");  }else if(s[0] == 'P' && s[1] == ' '){   if(lookup(root, s[2])) printf("%c existen", s[2]);   else printf("%c nao existen", s[2]);  }else{   root = Insert(root, s[2]);  } } return 0;}``

### URI Solution 1200 BST Operations I Code / URI 1200 solution in  C# (C Sharp):

Demonstration:

Just implement this in coding. Since having any problem just put a comment below. Thanks

Tags: URI Online Judge Solution, URI OJ Solution list, URI Problems Solution, URI solver, URI all problem solution list, URI 1200 BST Operations I code in C, URI 1200 BST Operations I code in C++, URI 1200 BST Operations I solution in C, URI solution, URI 1200 BST Operations I solution in C,URI 1002 solution in C++-CPP,URI 1200 BST Operations I solution in C# (C sharp),URI 1200 BST Operations I solution in Java,URI 1200 BST Operations I solution in Python,

#### By Maniruzzaman Akash

Maniruzzaman Akash is a freelance web developer with most popular Laravel PHP frameork and Vue JS