Back to course home
0% completed
Solution: Split BST
Problem Statement
Write a Recursive Approach to Split BST.
Given a Binary Search Tree (BST) and a target value, split the BST into two subtrees where one subtree contains nodes with values less than the target value, and the other subtree contains nodes with values greater than or equal to the target value. Return the two root nodes of the resulting subtrees.
Examples
Example 1:
-
Input:
-
Binary Search Tree:
4 / \ 2 6 / \ \ 1 3 7
-
Target: 5
-
-
Output:
- Split BST 1:
.....
.....
.....
Like the course? Get enrolled and start learning!
Table of Contents
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible