Тёмный

Binary Tree Part 1 | BST | Binary Search Tree - Data Structures & Algorithms Tutorials In Python #10 

codebasics
Подписаться 1,1 млн
Просмотров 218 тыс.
50% 1

Опубликовано:

 

2 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 171   
@codebasics
@codebasics 2 года назад
Do you want to learn python from me with a lot of interactive quizzes, and exercises? Here is my project-based python learning course: codebasics.io/courses/python-for-beginner-and-intermediate-learners
@rajeshpurshottamgupta8752
@rajeshpurshottamgupta8752 4 года назад
Sir i usually watch videos in hindi because i grab the things more quicker than english tutorials but your explanation is very impressive the way you explain the things are excellent god bless you sir and i am praying that you stay healthy.
@Ankurkumar14680
@Ankurkumar14680 4 года назад
Thanks a ton Sir, Data structure series is much-appreciated series as it is the foundation of programming. Also, lots of University exams are pending due to COVID-19, series on data structure will really help. Amazing teaching skills :)
@codebasics
@codebasics 4 года назад
Glad, you liked it Ankur.
@jorgegonzaloalfaro5378
@jorgegonzaloalfaro5378 4 года назад
'think about it, what will you do here?!' this guy is awesome.
@codebasics
@codebasics 4 года назад
:)
@markmariscal5111
@markmariscal5111 4 года назад
This needs to have the most plays for best explanation for Binary Tree! I pray you do algorithms in python as well that is a class I would purchase.
@actionsupplymining4242
@actionsupplymining4242 4 года назад
Yes rightly said
@kasyapdharanikota8570
@kasyapdharanikota8570 3 года назад
true
@ahmedel-sinousy4848
@ahmedel-sinousy4848 3 года назад
thank you.....you are the best....finally I understand Binary Search Tree because of you....Thank You Again ^-^
@codebasics
@codebasics 3 года назад
Glad I could help!
@BarongoCalvine
@BarongoCalvine 4 года назад
Thanks for the tutorial, they are really helping me, I have a DS interview coming up!
@codebasics
@codebasics 4 года назад
Glad I could help!and wish you best of luck for your interview 😊👍
@lemon.sandwich
@lemon.sandwich 4 года назад
How did the interview go?
@RadhamaniRamadoss
@RadhamaniRamadoss 2 года назад
Thankyou very much sir for these amazing videos.. After 15 years I am learning these concepts again and now I am getting these concepts more clear because of your crystal clear and simple way of explanation. I have a query in the way your have defined elements in inorder,preorder and posrorder traversal. sometimes you have added as elements += self.left.in_order_traversal(). Sometimes it is elements.append(self.data) , sometimes elements = [self.data]. Looks like the list is appended in 3 different ways: += , appened, []. Please explain when do use each of these.
@codebasics
@codebasics 2 года назад
1) Append is to insert a single element into an existing list 2) += is two join two lists into a single list 3) [] is used to initialize a new list They all serve a different purpose
@RadhamaniRamadoss
@RadhamaniRamadoss 2 года назад
@@codebasics It makes sense now.. Thankyou sir. Keep up the good work. God bless you
@vanchark
@vanchark 2 года назад
There is an error at around 21:30. You must return 'self.left.search(val)', otherwise your result will be 'None" since nothing is being returned to main.
@JaviMstv
@JaviMstv 2 года назад
true, he forgot to put it in the < case, so only values greater than root worked... it took me some mins to realize what was wrong lol
@pharaoh9483
@pharaoh9483 19 дней назад
He corrected this later in the video.
@fahadreda3060
@fahadreda3060 4 года назад
Another Great video , Thanks man , Love your videos , Learned a lot from them
@A.bensalih
@A.bensalih Месяц назад
awesome explanation!
@godza4735
@godza4735 2 года назад
Thank you a lot !! Upload more and Algorithms like binary search etc..
@humbertoventura1344
@humbertoventura1344 11 месяцев назад
this is well explained. Well done.
@alinayuh4883
@alinayuh4883 4 года назад
Thanks a lot! Although, I have some difficulties understanding the the in_order_traversal method. I will appreciate if you could explain the elements+=self.left.in_order_traversal()
@crabbyfish3691
@crabbyfish3691 3 года назад
think of it as: "for e in self.left.in_order_traversal(): elements.append(e)"
@austinscott1407
@austinscott1407 3 года назад
If the list is: [1, 2, 3, 4, 5] it's recursively calling the function on self.left, until it gets to the farthest left node. Eventually that final function returns a list of just: [1] The final function returns that list to the second last recursively called function, which adds it to it's own list to give us: [1, 2] And it keeps going, each recursively called function returns a list to the function called just before it. += in Python, when used with lists, adds two lists to eachother
@justjhonmichael7815
@justjhonmichael7815 3 года назад
Man, you deserve a sub!
@codebasics
@codebasics 3 года назад
I appreciate that!
@SwagatSusmoy
@SwagatSusmoy 3 года назад
​ @codebasics this is going to be a very specific request but can you please add a video explaining how to balance a binary tree to get the optimum performance and some of the special trees like AVL... Would be really helpful. I genuinely appreciate your work and have shared your playlists with my friends too. Thank you so much.
@thesoundguysam5225
@thesoundguysam5225 4 месяца назад
What if the number_list was [1, 4, 17 .... ]. In that case through your code, the root node would be 1 and the entire tree would be created to the right side of the root node. That means the root node is not really in the center of the two sub-trees. Then how exactly is this In-order traversal if there is no left sub-tree at all?
@yuanweidonuts
@yuanweidonuts Год назад
I have a question. If we start the input element [ ] from the minimum number, for example, 1. Does it still work? Cause it seems like the whole number tree is on the right side. Do we need to add some conditions or limitations to the input element? Or the right-side tree is okay?
@etorty_dev
@etorty_dev 3 года назад
These are the best video series on data structures and algorithms! Keep up the great work, Codebasics!!
@chaitanyareddy7597
@chaitanyareddy7597 3 года назад
Hello Dhaval, Much appreciated and many thanks for educating us. For the in order traversal , i some how feel that we can use list as class variable and then append the node data when we hit the exit condition of recursion to reduce the confusion which i felt. def in_order_traversal(self): if self.left: self.left.in_order_traversal() BinarySearchTreeNode.in_elements.append(self.data) if self.right: self.right.in_order_traversal() return BinarySearchTreeNode.in_elements
@prithirajbhuyan4137
@prithirajbhuyan4137 3 года назад
i cpoied this function, but it says in_elements is not defined....
@chaitanyareddy7597
@chaitanyareddy7597 3 года назад
@@prithirajbhuyan4137 did you declare the in_elements array in the binary tree node class ?
@prithirajbhuyan4137
@prithirajbhuyan4137 3 года назад
@@chaitanyareddy7597 yeah
@aswath8265
@aswath8265 3 года назад
Bro we r just calling that function how does it returns some value
@kashishshah5650
@kashishshah5650 3 года назад
Need to add return self.left.search(val)
@ফকিরতালিব
@ফকিরতালিব 7 месяцев назад
Thanks, I am grateful to you!
@Jack_X075
@Jack_X075 3 года назад
Outstanding tutorial. Great refersher!!
@codebasics
@codebasics 3 года назад
Glad you liked it!
@tharindusathsara3414
@tharindusathsara3414 Год назад
Really very happy about finding such an obvious and understood funny video series about data structures and algorithms. Everything is 100% clear with deeply explained theories and well-understood practicals. Also, the exercise series with the videos are highly appreciated. Dear sir thank you so much for the fantastic video series. ❤💖
@shivamdubey4783
@shivamdubey4783 2 года назад
self.left.add_child()sir plzz explain what is this how this works you have not explained anuything like this in python
@DiaaHaresYusf
@DiaaHaresYusf Год назад
hi , I tink the slid where you explaining the pre_order is having in correct array : [15, 7, 12, 14, 20, 23, 27, 88] -> I am using the same exact method and its not making an output like the one on slides , thanks
@DiaaHaresYusf
@DiaaHaresYusf Год назад
sorry , I was using the same in_order_traverse inside post_order and pre_order 😂😂😂😂😂😂😂😂
@jaheerkalanthar816
@jaheerkalanthar816 4 года назад
very honestly sir, This is my first tutorial i clear the problem within one hour, Dhaval sir u r a great teacher,please upload some more videos about improve programming skills,how improve logical thinking please sir, I really love u sir,May god bless for long live for u sir
@codebasics
@codebasics 4 года назад
Glad you liked it 😊👍
@riyana2428
@riyana2428 4 года назад
Today, I learned amazing recursing techniques. Thank you so much sir.
@codebasics
@codebasics 4 года назад
I am happy this was helpful to you.
@mukulkathayat6288
@mukulkathayat6288 2 года назад
Solution for post and pre traversal seems to be incorrect, maybe I'm wrong but it's only working when the list is already arranged in pre_order mode...........
@vidhanrathore5954
@vidhanrathore5954 2 года назад
Thanks a lot sir
@deghanandreddy7168
@deghanandreddy7168 4 года назад
Please upload the playlist of all Data structures regularly
@DrKane96
@DrKane96 2 года назад
whenever coders get any problems, indians always give solutions
@lalitameena3321
@lalitameena3321 2 года назад
Thanks a lot for posting these videos. I have been procrastinating algorithms and data structures for a while coz I wasn't able to understand data structures apart from arrays as well as recursion and after watching this video I am implementing linked list and BST in Python in just one day :D
@kzr_567
@kzr_567 4 года назад
Hi, at 18:07, you have ' elements = [] ' , arent you re initialising the list and recursively it should not save the appended elements??
@omkarnag24
@omkarnag24 3 года назад
the function in_order_traversal runs separately everytime it is called. So the data stored in 'elements' is different for each call of the function.
@austinscott1407
@austinscott1407 3 года назад
it's a local variable, if you run the function 10 times it will allocate a new place in memory each time the function runs.
@marianpascu8474
@marianpascu8474 Год назад
Hi, just a curiosity. Since BST is recursive, should not the time complexity for searching or inserting actually be O(nLogn)?, rather than O(logN)?
@joxa6119
@joxa6119 11 месяцев назад
If you are new, please watch the Recursion topic on the last chapter in this series, because this topic will use Recursion concepts extensively as should become the pre-requisite before you started.
@aswath8265
@aswath8265 3 года назад
Can't understand that inorder transverse function sir where can I find it
@SKumar-Munna
@SKumar-Munna 4 года назад
Nice explanation sirji. (y)
@beimnetguta3953
@beimnetguta3953 2 года назад
Helpful
@r.vigneshkumar81
@r.vigneshkumar81 5 месяцев назад
00:01 Binary search tree is a special type of binary tree with ordering criteria 02:45 Binary Search Tree properties and search efficiency explained. 05:27 Binary search tree offers efficient search and insertion operations 08:11 Understanding inorder traversal in Binary Search Trees 10:47 Adding nodes to a binary search tree involves checking for existing values and determining the correct subtree to place the new node 14:03 Explanation of in-order traversal method in binary search tree 17:20 Building Binary Search Tree and its utilities 20:15 Recursion in binary search tree search operation 23:00 Enhance Binary Search Tree Node Class with Additional Methods
@Vinicius-nd8nz
@Vinicius-nd8nz 4 года назад
You are amazing, so easy to learn from you!! An excellent teacher!
@pkavenger9990
@pkavenger9990 2 года назад
I really get surprised when some people actually work in white background. I think it is better if you use black background, it is easy on the eyes of people who are watching the video.
@sandeepjerubandi4473
@sandeepjerubandi4473 2 года назад
I am the fresher here and do i need these coding skills to crack any interviews bcoz i am pretty good at those topics but not on coding. Please reply anyone please!..
@gauravkantrod1205
@gauravkantrod1205 3 года назад
Great Video but you can us extend instead of "elements += self.left.in_order_traversal()"
@aswath8265
@aswath8265 3 года назад
Bro we r just calling that function how is the data inserted
@ayushjhajriya4033
@ayushjhajriya4033 2 года назад
this is giving output None, why? def search(self,val): if self.data==val: return True if val < self.data: if self.left : self.left.search(val) else: return False if val > self.data : if self.right: self.right.search(val) else: return False
@vanchark
@vanchark 2 года назад
you must return self.left.search(val) and self.right.search(val). otherwise no results will get brought back
@papercut._.
@papercut._. 3 года назад
can someone explain how elements = [] can store values even after it is being re-initialized every time recursively at 18:07 and also the traversal function is wrong it gives wrong results please correct it, it fails to switch between the right of the left subtree and left of the right subtree. it just prints all the left together and all the rights together
@crabbyfish3691
@crabbyfish3691 3 года назад
Please, think before you write. Every time the function is called, a new elements variable is temporarily created. So there is an element list for every function call (This isn't a waste of memory since the variable are deleted after the function returns).
@austinscott1407
@austinscott1407 3 года назад
'elements' is not a global variable, it's local to the traversal function. So you call a traversal function and it allocates memory for a variable 'elements'. Then the function is called again recursively, and that newly called function also has it's own allocated memory which we've defined as elements. Two (or more) functions can have the same local variable name and still refer to different memory allocations
@jaypatel2436
@jaypatel2436 2 года назад
Sir, thank you for the session. However, We have to find all 3 traversals (in order , preorder, post order) by given graph. But the code is taking list as an input so how can I convert that graph into list
@Nimmi_bro
@Nimmi_bro 2 года назад
very clear concepts videos.. Thank you so so much
@devendudileep1149
@devendudileep1149 3 месяца назад
Is this playlist enough for technical round in the interview to atleast implement the basic logic?. Someone plz do reply.
@netraamrale3850
@netraamrale3850 2 года назад
Data Structures Made easy. You are amazing sir, I understand the complete concept with USE CASE(Very important) in one shot. Moreover, how the complexity is calculated.Sir, may I know your name?
@codebasics
@codebasics 2 года назад
Thanks 🙏 my name is Dhaval Patel
@MuraliChari
@MuraliChari 4 года назад
This is better than a paid course. Great stuff!
@codebasics
@codebasics 4 года назад
I am happy this was helpful to you.
@nanakbanerjee8364
@nanakbanerjee8364 4 года назад
Rasode mei koi cooker se chane nikal raha hei....
@LamNguyen-jp5vh
@LamNguyen-jp5vh 2 года назад
Hi, I have a question about the binary search tree. Is it possible if the right child node under node 7 at 5:56 is a number that is greater than 15 (for example 16). I think we can because you just mentioned that the right child node is larger than the value of the parent node and the left child node is lesser than the parent node. If 16 is able to be added under node 7, will the binary search algorithm for number 16 have some problem at the beginning, we choose to find the number from the right branch because 16 is larger than 15. I'm sorry for this long comment but I will appreciate any help! Thank you so much and have a great day!
@LamNguyen-jp5vh
@LamNguyen-jp5vh 2 года назад
I figured it out! I will still leave it over here for anyone that has the same concern as me.
@kirandeepmarala5541
@kirandeepmarala5541 4 года назад
Sir, Thanks a Lot.I don't know how to appreciate You..Sir, Please make this Series complete end to end..Please..
@studyonly9080
@studyonly9080 8 месяцев назад
At 8:20 , Please anyone review 🙏🙏 is Post order Traversal correct ? or will it be like this - [7, 14, 12, 20, 23, 88, 27, 15]
@chiemerieokoro3038
@chiemerieokoro3038 2 года назад
You are a great teacher. This series is supposed to be called Algorithms and data structures made easy. Thank you chief.
@ashishmaikhuri3950
@ashishmaikhuri3950 6 месяцев назад
Where is the video you told you will share the link for the Tree terminology
@sourabhyadav8757
@sourabhyadav8757 3 года назад
def calculate_sum(self): left_sum = self.left.calculate_sum() if self.left else 0 right_sum = self.right.calculate_sum() if self.right else 0 return self.data + left_sum + right_sum This part i couldn't understand...how this left sum is adding all the item on the left and how right sum is adding all the of right... Can someone explain it ?
@sagarkbasutkar
@sagarkbasutkar 8 месяцев назад
How can I insert "null" or missing node values to this implementation? @codebasics ?
@smaransure2234
@smaransure2234 3 месяца назад
what if a node has two branches that are bigger value than the node but left is the smaller value and right is the bigger value
@ayushjhajriya4033
@ayushjhajriya4033 2 года назад
my search function is not working. it is giving me output None. please help me to find mistake in my code.
@ayushjhajriya4033
@ayushjhajriya4033 2 года назад
class binary(): def __init__(self,data): self.data=data self.left=None self.right=None def insert(self,val): if val==self.data: return if val self.data : if self.right: self.right.search(val) else: return False def build_tree(arr): root=binary(arr[0]) for i in range(1,len(arr)): root.insert(arr[i]) return root b=[2,4,3,5,3,6,7,0,11,8,4,7] tree=build_tree(b) print(tree.print()) print(tree.search(5))
@idontknowwhattoputherethatsit
@idontknowwhattoputherethatsit 2 года назад
Tip for watching. play the video at 1.25x
@suryakantnayak6661
@suryakantnayak6661 2 года назад
sir can you make your voice a little softer it sound more metallic and sounds a bit harsh to listen. Thank you.
@sajawalsheraz6903
@sajawalsheraz6903 3 года назад
kia bakwas ha apna concept cleat ha ni ."It will work out" but how explain to kre bnda .
@magnacarta7045
@magnacarta7045 4 года назад
Great tutorial, but could you please explain the line 14 self.left.add_child(data) part and the other ones that does the recursive function? Like what does the self.left have to do with the function? It doesn't change the value of the data right? So it just calls the function again with the same data.
@magnacarta7045
@magnacarta7045 4 года назад
like, how does the value of self.left change after calling the function again?
@rahulganesh468
@rahulganesh468 3 года назад
@@magnacarta7045 I think the way it works is that it keeps calling itself until the self.left == None, or there are no other elements on the left. Then it assigns the node to be that new left element, so ig that's how it changes? I could be wrong so feel free to correct me
@austinscott1407
@austinscott1407 3 года назад
@@magnacarta7045 If you have a tree with 3 elements in the left node, then you call the function on the base node's self.left. Then the function calls itself on THAT node's self.left, which is like calling it on self.left.left on the original function. Eventually you get to the final node, which has self.left == None which is how the function knows when to stop
@PythonisLove
@PythonisLove 3 года назад
I am just so impressed by your explanation technique. Thankss!!
@codebasics
@codebasics 3 года назад
Glad it was helpful!
@songs123d
@songs123d 7 месяцев назад
The sorting time complexity is O(H). H=height of the BST its important difference since if every child have only 1 child on 1 side, then time complexity can reach up to O(n) time. n=number of nodes.
@arthireddyannadi8121
@arthireddyannadi8121 Год назад
Sir, Thank you for the tutorial, it helped me to understand BST better. However, I have a small doubt. For the above methods, when we are checking the search for the strings, we received none for sweden and uk. we modified the code using 'return'. However, when we used the same method for list of numbers , we got the boolean results correct. Could you please explain me why?
@karishmasewraj6437
@karishmasewraj6437 2 года назад
Can someone please explain the "self" in the code
@patrickcarrera5956
@patrickcarrera5956 3 года назад
Is there any reason on line 45: self.left.search(val) and 51 we have the same thing but rigth... but now we add return? any reason we why need to return this part, figure those lines are just to jump from nodes to nodes, why do we need to return one and not the other?
@vishalsiram1305
@vishalsiram1305 4 года назад
sir what model accuracy is best ? please reply sir
@ankitagupta919
@ankitagupta919 2 года назад
what is the base case for in order traversal
@anilkumarjha8055
@anilkumarjha8055 4 года назад
🙏thnx sir 🙏
@ai4sme
@ai4sme 2 года назад
Hi everyone! One question: with numbers =[17, 4, 1, 20, 9, 23, 18, 34], if I do numbers_tree.add_child(13), and check print(numbers_tree.right.data), 13 does not appear. However, the function in_order_transversal() is OK (output = [1, 4, 9, 13, 17, 18, 20, 23]). Any clue about it? Thank you!
@AdamACastaneda
@AdamACastaneda 2 года назад
If you built the tree with 17 as the root node (which is what this code does root = BinarySearchTreeNode(elements[0])) then the right node must be bigger, so I am guessing it will be 18. When you do add_child it runs through each node and checks to see if it is less or more then keeps going down that path. For example with 13, it will check against 17 and say its less, so it goes to left subtree and compare against that node and recursively ask less or more. 13 will end up SOMEWHERE in the LEFT subtree of 17.
@kmnm9463
@kmnm9463 2 года назад
Hi Dhaval, While going through the video again, I thought in the traversal for In Order and Pre Order, 23 comes before 20, as while visiting a node in DFS, the tread is till the leaf and then the previous nodes. This is my understanding. Please let me know if I am missing something. Want to get that cleared. Regards, Krish
@yusnardo
@yusnardo 4 года назад
Thanks for the tutorial Sir, Can you explain "elements += self.left.in_order_traversal()"?how is it works?
@actionsupplymining4242
@actionsupplymining4242 4 года назад
Really?
@Chaviotics
@Chaviotics 3 года назад
This means that for every time we recursively call the function, during that value, we append (add) that value in the list "elements"
@ShubhamKumar-br1ft
@ShubhamKumar-br1ft 3 года назад
try to debug on stack model, whereever the function is recalled, it will return to the same point after execution and remaining leftout portion of that function will execute
@aswath8265
@aswath8265 3 года назад
How is the self.left.in_order_transversal printing the array of data please anyone explain
@aswath8265
@aswath8265 3 года назад
Means self.left is a pointer
@surajagasti2309
@surajagasti2309 4 года назад
pls upload regularly
@codebasics
@codebasics 4 года назад
sure
@meralmaradia4774
@meralmaradia4774 2 года назад
Hello Sir, can you please create a video developing of project using only DSA ?
@bbatroll
@bbatroll Год назад
im rlly sad lmao
@maroofkhatib3421
@maroofkhatib3421 3 года назад
I have a small question to ask, Why are we defining the methods inside the class ? such as add_node, since root node is required everytime we add a node, It will unnecessarily increase the space complexity.
@someguy6076
@someguy6076 Год назад
Sure wish that I had found this video 6 weeks ago ... it is literally the entire assignment that I had to write.
@riyabgia7220
@riyabgia7220 2 года назад
Thank you.
@cozmo7344
@cozmo7344 2 года назад
Ty very much for the explanation, i found it very easy to implement and understand but i have a question. Is it possible to do an AVL tree using this algorithm? I find it very hard to do
@kmnm9463
@kmnm9463 2 года назад
Hi Dhaval, You have presented the coding magic behind BST in a incisive way. Very precise in the coding structure. Excellent , once again. I have been recommending your videos many and it is sure to have multiplier effect. Regards, Krish
@banugoud2217
@banugoud2217 3 года назад
superb.............................................
@gopalraichand4810
@gopalraichand4810 3 года назад
your tutorials are good but sir please try to thoroughly
@winnienakimuli210
@winnienakimuli210 2 года назад
Sir, you are a lifesaver, the best tutorials on data structures and algorithms; thank you greatly. I am forever grateful, and I will recommend your tutorials to all my colleagues, thank you so much!
@vaddinimisha5100
@vaddinimisha5100 3 года назад
Can u please make video on implementation of B+ tree in python
@Pattii248
@Pattii248 Год назад
Amazing tutorial, thank you!
@suharam.s6570
@suharam.s6570 2 года назад
This playlist contains all my "Data Structure" course from Degree. So helpful for preps. :)
@ftt5721
@ftt5721 3 года назад
Thanks. I learned that in-order traversal in BST returns elements in ascending order.
@priyanshupurohit5431
@priyanshupurohit5431 Год назад
Thankyou for creating the series sir , i am really enjoying and learning a lot from this :)
@swaroopkv4540
@swaroopkv4540 2 года назад
What is difference between just recursively calling method and calling method using return?
@saravanan.r5079
@saravanan.r5079 Год назад
Found the answer? I badly need it
@technicalutkranti
@technicalutkranti 2 года назад
Great explanation sir :)
@sayantanmitra7897
@sayantanmitra7897 4 года назад
Hi did you remove these codes from Github?
@Khanarmaanrokz
@Khanarmaanrokz 3 года назад
I could not understand the in-order function, could someone explain please in detail.
@austinscott1407
@austinscott1407 3 года назад
Lets say there's a list [1, 2, 3, 4, 5] Function will start at a root node (3) and initialize an empty list. First it checks self.left of 3, which exists as the node (2). It recursively runs the same function on that node(2). Because node (2) also has a self.left, it gets recursively run again on node (2) which gets us to node (1). Finally node (1) doesn't have self.left so it returns us a list of it's data, which is just: [1] So the function running on node (2) has the list [1] returned to it, and it adds [1] to it's own data via += so your new list is [1, 2]. Eventually it adds the node and then moves onto self.right, and eventually you have a list of elements in numerical order
@Khanarmaanrokz
@Khanarmaanrokz 3 года назад
@@austinscott1407 thank you for your time
@davidhuang3830
@davidhuang3830 3 года назад
I do not think that is the case in you example with his code. In his code he set the root as element[0]. In other words, your Node 1 will be the root based on the build_tree function. Then since all the numbers in the array is greater than the root. It would have a all be connected to the right of the node. It should look something like this. 1 --2 ---3 ----4 -----5
@sarveshsawant7232
@sarveshsawant7232 Год назад
Thanks man, this is gold
@namratashinde9157
@namratashinde9157 Год назад
Easiest tree tutorial i have ever seen👍
Далее
When Goalkeepers Get Bored 🤯 #3
00:27
Просмотров 1,7 млн
Living life on the edge 😳 #wrc
00:17
Просмотров 2,1 млн
Лиса🦊 УЖЕ НА ВСЕХ ПЛОЩАДКАХ!
00:24
Negative Time is Real, Physicists Confirm. Kind Of.
6:59
Binary Search Tree in Python
22:59
Просмотров 51 тыс.
When Goalkeepers Get Bored 🤯 #3
00:27
Просмотров 1,7 млн