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 :

  1. 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
  2. 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