this is showing tle.Please help.
Build bst error
hello @srshubhi398
u need to balanced bst , and then u need to print preorder.
also check input format .
in ur present code u r building normal bst.
make required changes and then try
is this the correct way?I am not able to understand how to use the balanced function.Also it is showing that root is undeclared.Please help.
- Get the Middle of the array and make it root.
- Recursively do same for left half and right half.
- a) Get the middle of left half and make it left child of the root created in step 1.
- b) Get the middle of right half and make it right child of the root created in step 1.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.