Insert into a Binary Search Tree | Leet code 701 | Theory explained + Python code

preview_player
Показать описание
This video is a solution to Leet code 701, Insert into a Binary Search Tree. I explain the question, go over how the logic / theory behind solving the question and finally solve it using Python code.

Comment below if you have a better solution to this problem!

Let me know if you have any feedback and don't forget to subscribe for more videos!

Code:

More leetcode questions solved:

Timestamps:
0:00 Question Explained
0:41 Solution Explained
3:21 Solution #1 code
4:40 Solution #2 code

Gear used:
Рекомендации по теме
Комментарии
Автор

the most clearest video for explaining binary tree problems. please upload more videos!

wenwenzhang
Автор

Very clear explanation! Thanks for the video!

zhuohuawu
Автор

I had a doubt,
In the listtoBST function where you convert the inorder traversal into a BST you took th middlemost element as the root but it is not neccesary that the middle element is always the root right?
I mean what if the left subtree has more elements than right subtree?

pythonenthusiast