• Courses
  • Tutorials
  • DSA
  • Data Science
  • Web Tech
September 27, 2024 |190 Views

SDE Sheet - Merge Two Balanced Binary Search Trees

Description
Discussion

This video is part of the Binary Search Tree section under GFG SDE Sheet.

Given two BSTs, return elements of merged BSTs in sorted form.

Examples :

Input: BST1:       5      /   \     3     6    / \   2   4   BST2:         2       /   \      1     3             \              7             /            6 Output: 1 2 2 3 3 4 5 6 6 7 Explanation: After merging and sorting the two BST we get 1 2 2 3 3 4 5 6 6 7.

Do check out:-
Problem: https://www.geeksforgeeks.org/problems/merge-two-bst-s/1
SDE Sheet Link: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/
Article Link: https://www.geeksforgeeks.org/merge-two-balanced-binary-search-trees/