DLL To BST | BST | C++ Solution
DLL To BST, is a BST related problem and in this post we will see how we can solve this challenge in C++
convert a DLL to BST can be done in 2 ways :
- recursively create the trees by finding the midpoint of the linked list in each pass,TC:O(nlogn) ,we need to find the mid point each time for the linked list
- create tree from the leaf nodes TC:O(n)
Please check the main.cpp snippet for the solution.
This solution originally posted at: Github by @susantabiswas