Convert Sorted Array to Binary Search Tree

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

So, guys, to understand how it works you first need to learn how In order traversal works in the tree. Binary search algorithm, binary search tree and in order traversal are the closest relatives in trees and arrays.

giorgi
Автор

Used to work as hardware engineer, trying to become a back end programmer now. Been doing problems on leetcode in the last 2 weeks. every time when i search a problem on youtube, your video shows up. Thanks for spending the time to make these videos and posting them on youtube. It really helps!

kevindai
Автор

Thanks for sharing the solution! Your videos are very helpful

Could you please create videos explaining the recursion trace. It will help to visualize constructing the tree step-wise

gargipg
Автор

I have been asked the iterative version of the problem

rmadhavmca
Автор

kindly make a video explaining the recursive calls step by step....it will be extremely helpful!!

JamesHalpert
Автор

You're a legend thank you! Been checking out all your videos, real good explanations thank you!!!

pewdiepieschair
Автор

why mid = left + (right - left) /2.... so it will do (right - left)/2 first and then add left.. It doesn't make much sense...

leomonz
Автор

We missed as to why middle element is root, what makes middle element the root ? should have said two lines about that also to visualize how many ways can bst can reside in an array.

ankurbrdwj
Автор

great vid had the concept but needed some help with the implementation this is both easy to understand and runs great real quality code pants bro

Endlessvoidsutidos
Автор

Hi Kevin, are there any video as you said for recursion?

staythecoursenote
Автор

Why this takes o(n) time we are using divide and conquer so it should be logn and if this is o(n) because we are accessing all n elements so why it takes nlogn in merge sort

rohitbaisane
Автор

how come you can't do int mid = left + right / 2?

jumbogoe
Автор

How does it work in Java? I mean, left + (right - left) / 2 will not always yield a round int. For example, if left is 2 and right is 5, then 2+(5-2)/2 = 3.5. I assume Java will round/floor/ceil it internally? Well, you can't do arr[3.5] :)

idemchenko-js
Автор

Please make a video of recursion used for trees.

yahyashaikhworld
Автор

Hey Kevin how do we know its always going to be height-balanced!?

SR-wevl
Автор

int

Code returned wrong answer till I ADDED ceil

atulshrivastava
Автор

Sir, whats the time complexity for your solution ? O(n) ? Great video By the way !!!

ashishpawar
Автор

what's the space complexity here?

JJ-Bond
Автор

As a non cs degree graduate, where should I start learning DS and algorithms to crack these kinds of questions?

sidhantmanchanda
Автор

Hi Kevin ..Your code is not working in leetcode now. Can you please upload a video with modified version?

b.ravirao