Tree construction a Binary Tree from Postorder and Inorder traversal [Amazon, Adobe]

Problem: Provided Inorder and PostOrder of a tree. Construct the tree and print it in PreOrder traversal. #include <stdio.h> #include <iostream> #include <string.h> #include<stdlib.h> #include <string> using namespace std; struct Node{ int data; Node *left; Node *right; }; int search(int in[],int in_stIndex,int in_endIndex,int data) { for(int i=in_stIndex;i<=in_endIndex;i++) { if(in[i]==data) return i; } } void pintPreOrder(Node*

Tree construction from Inorder & Preorder [ Microsoft ]

Problem: Provided Inorder and PreOrder of a tree. Construct the tree and print it in PostOrder traversal. #include <stdio.h> #include <iostream> #include <string.h> #include<stdlib.h> #include <string> using namespace std; int preOrderIdx=0; struct Node{ int data; Node *left; Node *rit; }; int search(int in[],int in_stIndex,int in_endIndex,int data) { for(int i=in_stIndex;i<=in_endIndex;i++) { if(in[i]==data) return i; } }

Binary Tree to Doubly LinkedList Conversion [ Microsoft – Amazon ]

Problem:Given a Binary Tree (BT), convert it to a Doubly Linked List(DLL) In-Place. The left and right pointers in nodes are to be used as previous and next pointers respectively in converted DLL.The order of nodes in DLL must be same as Inorder of the given Binary Tree. The first node of  Inorder traversal (left