Skip to content

Instantly share code, notes, and snippets.

@bkb181
Created July 10, 2020 11:02
Show Gist options
  • Save bkb181/fe228994319558a231423851e66c9388 to your computer and use it in GitHub Desktop.
Save bkb181/fe228994319558a231423851e66c9388 to your computer and use it in GitHub Desktop.
void inorder(node* root,vector<int>& res)
{
if(A==NULL)
return;
inorder(A->left, res);
res.push_back(root->data);
inorder(A->right, res);
}
void merge_bst(node* root1, node* root2)
{
vector<int> res;
int n;
inorder(root1,res);
n=res.size();
inorder(root2,res);
inplace_merge(res.begin(), res.begin()+n,res.end());
print(res);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment