Tree (General Tree) - Data Structures & Algorithms Tutorials In Python #9

  Рет қаралды 273,111

codebasics

codebasics

Күн бұрын

Пікірлер: 220
@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
@smaransure2234
@smaransure2234 5 ай бұрын
Please sir don't inject coronavirus into my computer I haven't looked at solutions yet but please don't inject coronavirus into it I beg you
@malikrumi1206
@malikrumi1206 2 жыл бұрын
Ok, this video is two years old, and you've moved on to a lot of other things. But I just want to point out - because I've searched - while there are plenty of so-called tutorials about binary trees, there is almost nothing about general trees. I get it, people always want to take the easiest option, even if that doesn't really help their followers in the long run - or the short run, for that matter, because they quickly find out that too simplistic tutorials don't get you very far in the real world. So this is an appreciation, and a thank you, for the thoroughness and completeness of your work, and your interest in actually helping people learn what they need to know.
@sukurcf
@sukurcf 4 жыл бұрын
The best thing about your videos is that you provide a real world example for every data structure that we are going to discuss.
@mohammadmaximilian3077
@mohammadmaximilian3077 3 жыл бұрын
i know Im asking randomly but does anyone know a tool to get back into an Instagram account?? I was dumb lost my account password. I would love any tips you can give me.
@souvikmitra2652
@souvikmitra2652 3 жыл бұрын
sir , I had my computer teachers in my college . But you are the one who actually taught me the Data Structure concepts and made me think why they were important and why we need to do know it . Some teachers sometimes dont know , how critical their roles are in some one life . Happy Teachers day to you even though today is not the teacher's day
@MilahnMartin
@MilahnMartin 3 жыл бұрын
Watching this is 2021 for my Software Engineering's degree and man you are awesome ! Thank you for this awesome video !
@d25102
@d25102 Жыл бұрын
genuinely one of the most helpful tutorial series on this website! thank you!
@ludviklamb
@ludviklamb 3 жыл бұрын
I came to this video after not understanding Udacity’s explanation of it. You’ve done a fantastically better job at explaining this. Thank you !
@codebasics
@codebasics 3 жыл бұрын
Glad it was helpful!
@justbewithme2009
@justbewithme2009 2 жыл бұрын
I recently completed my MS in engineering in US. Have been learning python specifically to enhance my ML skills. Your videos have been really helpful. Appreciate your efforts.
@narayandatye9282
@narayandatye9282 2 жыл бұрын
Hey man I needed some help , if you don't mind.
@carzycults6119
@carzycults6119 3 жыл бұрын
I compiled the code without maintaining parent link it worked fine for traversing from root to leaf node
@narinpratap8790
@narinpratap8790 3 жыл бұрын
Bro this is awesome! Your DS & Algo tutorials are so easy to understand and they also cover the fundamentals very well. Thanks so much for doing this :D
@simpletermsexplained
@simpletermsexplained 3 жыл бұрын
Thank you #codebasics, I wasn't understanding Tree implementation in python until I got this tutorial. Thank you
@ece-b-087-thamaraiselvansp5
@ece-b-087-thamaraiselvansp5 3 жыл бұрын
Really helpful for for every person because I college level every teacher they teach only the theory concept but you can clear the concept real life examples In Linux file system is like this model.before seen this video I am not understanding where we can use the tree concept in real life.but know I am understanding very clearly.please upload these kind of real life data structure concept.❣️
@Mohamed-hm7jo
@Mohamed-hm7jo 4 жыл бұрын
We are waiting for your data structure continuation series...please post asap so we make use of this quarantine time.Also request a solved example per ds model. Thanks
@studyonly9080
@studyonly9080 9 ай бұрын
Thank you for the playlist ❤❤❤ For Q.1 , I found it difficult to solve the logic.... For Q.2) It was pretty simple Using this playlist for my GATE preparation 💪💪💪
@Ankurkumar14680
@Ankurkumar14680 4 жыл бұрын
Very informative video sir, thanks for sharing....request to upload next one soon :)
@anuvind_m
@anuvind_m Жыл бұрын
For printing levels, I found a much better and easy implementation. Hope this helps! def printTree(self, level=0): indent = " " * level if level==0: print(self.data) else: print(indent +"|__"+ self.data) if self.children: for child in self.children: child.printTree(level + 1)
@tionut4228
@tionut4228 4 жыл бұрын
Love your data structures and alogrithms series!
@codebasics
@codebasics 4 жыл бұрын
i'm glad :)
@sanjeevKumar-eg6hp
@sanjeevKumar-eg6hp Жыл бұрын
Thanks for a such simple and short explanation all information was to the point.
@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. ❤💖
@muhammedrajab2301
@muhammedrajab2301 3 жыл бұрын
This tutorial was a bit tricky but I managed to learn this and I did the exercises correctly without looking the solution. Thanks a lot Sir!!!!!!
@annlaosun6260
@annlaosun6260 6 ай бұрын
Thank you so much. This tutorial and excerise is the most helpful one for me to understand python class.
@PaulinhoOsfaya1
@PaulinhoOsfaya1 4 жыл бұрын
hahahahahahaah "if you directly look the solution, I gonna inject corona virus in your computer!" Dude, I laughed so hard! Awesome!
@codebasics
@codebasics 4 жыл бұрын
Ha ha.. 😊👍
@karthikeyani07
@karthikeyani07 4 жыл бұрын
This video is amazing ! Looking forward to upcoming videos .I am a beginner and this data structure series helps me a lot!!
@codebasics
@codebasics 4 жыл бұрын
Glad you liked it karthi
@Sirius39170
@Sirius39170 2 жыл бұрын
Great video.
@vileider
@vileider 2 жыл бұрын
21:48 XD XD. Like I would hear myself sometimes. You have got my like for it.
@ccdtech5394
@ccdtech5394 3 жыл бұрын
Thanks for the video, I've had a harder time finding n-ary tree information, so much is about binary trees
@CarrotOmelette
@CarrotOmelette 4 жыл бұрын
Thank you so much for the tutorial! I'm new to data structure and all your explanations help a lot! Hopefully it will help me land a job one day. :)
@StudyGyaan
@StudyGyaan 3 жыл бұрын
Awesome Tutorial - when ever i want to revise, i just go through these tutorials
@codebasics
@codebasics 3 жыл бұрын
I am happy this was helpful to you.
@StudyGyaan
@StudyGyaan 3 жыл бұрын
@@codebasics I saw ur comment, at the same time I was watching ur binary search video 😁
@devisowmyamorampudi1898
@devisowmyamorampudi1898 3 жыл бұрын
def print_tree(root,indent): print(indent + root.data) if len(root.children) > 0: for child in root.children: print_tree(child,indent*2) print_tree(root," ") This can get you the indentation without counting levels. btw thanks pal;)
@PresidentArmer
@PresidentArmer 2 ай бұрын
Excellent video, thank you so much!
@alooooshm
@alooooshm 4 жыл бұрын
Thanks a lot! We are waiting for your data structure continuation series...
@a.human.
@a.human. 2 жыл бұрын
No lie, this was one of the best tree tutorials ever! definitely recommending to each of my friends :)
@thisissharief7651
@thisissharief7651 3 жыл бұрын
your knowledge in oops concept is excellent ...
@cristinocanga
@cristinocanga 2 жыл бұрын
This is pure gold Got say that
@aaronaaronaaron5922
@aaronaaronaaron5922 3 жыл бұрын
This tutorials are as funny as excellent!! Thanks 😁😁😁
@codebasics
@codebasics 3 жыл бұрын
Glad you like them!
@digvijaywaghela3408
@digvijaywaghela3408 2 жыл бұрын
only one word.... Awesome!
@haokang1375
@haokang1375 3 жыл бұрын
Awesome Video! You made a clear explaination of everything!
@moodmaker2796
@moodmaker2796 2 жыл бұрын
Haha, I watched your vids about Classes, came back to this one listened to "child is an instance of tree node class, i will have a parent property and ..." and my brain instantly shuts off, not understanding the relationship xD I get inheritance within a new object. But the jiggle juggle of two methods within the main class creating the child and the parent within itself is killing me hahaha
@helloworldcsofficial
@helloworldcsofficial 4 ай бұрын
Great explanation. Thank you!
@harishhere574
@harishhere574 3 ай бұрын
computing A level saver
@kacjugr
@kacjugr 2 жыл бұрын
I often find that writing iteration-over functions in the same space as recursion-into functions can cause people a ton of issues with understanding. Instead, you could also write get_level() recursively like this: def get_level(): if not self.parent: return 0 else: return self.parent.get_level() + 1
@francescodiniccolo
@francescodiniccolo Жыл бұрын
Absolutely brilliant and enjoyable to watch, thank you!
@platnnum1129
@platnnum1129 4 жыл бұрын
Your videos saved my this semester thank you so much
@Nahzh-m1r
@Nahzh-m1r 5 ай бұрын
The best video ever
@anaghaareddy9318
@anaghaareddy9318 Жыл бұрын
Thank you sir these videos are helping a lot
@Twoman-bodyweight-journey
@Twoman-bodyweight-journey 2 жыл бұрын
Nice representation, thank you.
@davidrowlands8548
@davidrowlands8548 2 жыл бұрын
Yet another excellent lesson. Thanks again.
@jorgegonzaloalfaro5378
@jorgegonzaloalfaro5378 4 жыл бұрын
bro you are so good at teaching!! thank you!!
@codebasics
@codebasics 4 жыл бұрын
Glad, you liked it. 😊
@celestinejoy9519
@celestinejoy9519 3 жыл бұрын
Wow so nice .Your dsa playlist is so good and u explained it very well . It was really helpful. Also the exercises were interesting.
@salin.chaudhary
@salin.chaudhary Жыл бұрын
thank you very much for such an awesome explanation 🤗
@netraamrale3850
@netraamrale3850 3 жыл бұрын
This is superb....!!!!!!!
@k0tyak1t15
@k0tyak1t15 Жыл бұрын
that's a brilliant guide thank you!
@codebasics
@codebasics Жыл бұрын
Glad you liked it!
@runeheidt
@runeheidt 3 жыл бұрын
This was soooo great. You helped me a great deal. Thank you.
@codebasics
@codebasics 3 жыл бұрын
Glad it was helpful!
@CommonNoun9
@CommonNoun9 4 жыл бұрын
Really like your videos man, keep 'em coming
@lucas86999
@lucas86999 4 жыл бұрын
Thank you Dhaval for this, this is what I was looking for. Great jog!!!!!!!!!
@codebasics
@codebasics 4 жыл бұрын
Glad it was helpful!
@PriyankaSingh
@PriyankaSingh 4 жыл бұрын
Can you cover more topics as a part of this series such as heaps, priority queues?
@karthik9354
@karthik9354 4 жыл бұрын
Sure
@parthbansal3172
@parthbansal3172 3 жыл бұрын
Hii
@MadhuExplorer
@MadhuExplorer 4 жыл бұрын
Thanks for creating data structure videos..
@codebasics
@codebasics 4 жыл бұрын
Glad you like them!
@naveenkrishnavamshi2502
@naveenkrishnavamshi2502 4 жыл бұрын
@@codebasics can you explain me this "child.parent = self" i did not get it properly in the video
@iShubhamPanchal
@iShubhamPanchal 4 жыл бұрын
🙏Dhanyavaad 💕
@techatival
@techatival Жыл бұрын
Thank you! This was really usefull.
@Turjak_art
@Turjak_art 3 жыл бұрын
Very nice sir, thank you
@podaisotopaclaudia
@podaisotopaclaudia 3 жыл бұрын
This video helped me understand a lot this topic, thank you !!!
@codebasics
@codebasics 3 жыл бұрын
Glad it was helpful!
@shellysinha5429
@shellysinha5429 3 жыл бұрын
Write a function called searchBFS which given the tree or graph as defined below returns every number smaller than 4 in the order it was found using the breadth first technique.
@art_ik
@art_ik 3 жыл бұрын
Thanks, Best tutorials to get started
@codebasics
@codebasics 3 жыл бұрын
👍😊
@hiraunzela4378
@hiraunzela4378 2 жыл бұрын
This is insane.thanks
@priyanshupurohit5431
@priyanshupurohit5431 Жыл бұрын
ThankYou very Much sir
@deepam.g4558
@deepam.g4558 3 жыл бұрын
Very useful. Thank you
@dennisearle
@dennisearle 11 ай бұрын
Fantastic! Thanks 👍
@elchiringuitodenaty3336
@elchiringuitodenaty3336 3 жыл бұрын
Thank you so much, very useful 🙌🙌
@Vinicius-nd8nz
@Vinicius-nd8nz 4 жыл бұрын
Thank you for the video!!! Wonderful explanations!
@thecamelbackfiles3685
@thecamelbackfiles3685 3 жыл бұрын
Wow. So clear!
@babatombana4530
@babatombana4530 2 жыл бұрын
It's amazing!
@joxa6119
@joxa6119 Жыл бұрын
I don't understand the `child.parent=self` part. What did you actually do?
@RaghavTigadi-de3xv
@RaghavTigadi-de3xv 9 ай бұрын
same here
@hk254lyt8
@hk254lyt8 6 ай бұрын
Parent was inititialized to None in the beginning because the root doesn’t have a parent but in the add_child() function, since this function adds children to the list using self.children.append(child) it becomes a parent hence child.parent=self I’m not good at teaching hope you this makes sense lol
@ahmedkhalid6481
@ahmedkhalid6481 5 ай бұрын
THANK YOU SO MUCH !
@jorgegonzaloalfaro5378
@jorgegonzaloalfaro5378 4 жыл бұрын
Thanks so much for this!!!
@jenil16
@jenil16 9 ай бұрын
my print function of tree exercise problem-2 : def print_tree(self, level): spaces = ' ' * self.get_level() * 2 prefix = spaces + '|--' if self.parent else '' print(prefix + self.data) if self.children and self.get_level()+1
@manideep6814
@manideep6814 3 жыл бұрын
@23:17 Sir, I cannot have Corona Virus in my computer, I found the exercise interesting and have solved it without looking at the solution.
@syamkumarpujala5736
@syamkumarpujala5736 3 жыл бұрын
Solution for both the exercise def print_tree(self,arg,level): run_lvel=self.get_level() spaces = ' ' * run_lvel * 3 if run_lvel > level: return prefix = spaces + "|__" if self.parent else "" if arg =="name": print(prefix + self.data[0]) elif arg == "designation": print(prefix + self.data[1]) else: print(prefix + self.data[0]+ ' ( '+self.data[1]+')') if self.children: for child in self.children: child.print_tree(arg,level)
@lordloneshadow7572
@lordloneshadow7572 3 жыл бұрын
This madlad using python2 in 2020
@pprabhakar8531
@pprabhakar8531 Жыл бұрын
I got a small doubt. print_tree is a method of class (Treenode) right. at the end of the code, we used (print_tree) method. Rather than using (root.Treenode._print_tree) why we are using just(root._print_tree)
@ritikbhilware4030
@ritikbhilware4030 4 жыл бұрын
Hey, Can you also make a playlist for all the different kinds of algorithms used? Will be very helpful.
@glenn8459
@glenn8459 4 жыл бұрын
@codebasics
@tusharsrivastava4328
@tusharsrivastava4328 4 жыл бұрын
sir please make videos on how to deal with text data in machine learning?
@jagritisehgal3867
@jagritisehgal3867 4 жыл бұрын
great explanation
@motidivya
@motidivya 3 жыл бұрын
Thanks a lot for the turtorial, The lecture was awesome but the ending (i will inject corona vurus) was super cringy.
@mananpatel884
@mananpatel884 3 жыл бұрын
just awesome
@codebasics
@codebasics 3 жыл бұрын
Glad you enjoyed it
@obadajaber2759
@obadajaber2759 3 жыл бұрын
amazing
@FahmiEshaq
@FahmiEshaq 11 ай бұрын
Thank you
@rameshthamizhselvan2458
@rameshthamizhselvan2458 Жыл бұрын
@codebasics Thanks so much, and I really appreciate how helpful your videos are! I've been working with Python data structures for more than a year and have about 7 years of experience. I am very comfortable using Python data structures. Does learning Java data structures help me crack FAANG?
@siddhanth177
@siddhanth177 4 жыл бұрын
I Directly looked at the solution! :P
@codebasics
@codebasics 4 жыл бұрын
now you are doomed :) you need to send your laptop for corona virus quarantinee :)
@sakshamsinha6945
@sakshamsinha6945 4 жыл бұрын
@@codebasics lol
@ankit7918
@ankit7918 4 жыл бұрын
Thank you sir 🙂
@codebasics
@codebasics 4 жыл бұрын
Most welcome
@abhishektripathi6596
@abhishektripathi6596 3 жыл бұрын
Thanks sir
@codebasics
@codebasics 3 жыл бұрын
Glad it was helpful!
@nipundileep1577
@nipundileep1577 2 жыл бұрын
Nice explanation sir.. One doubt.. Child.parent = self.. What does that convey?
@jaysoni7812
@jaysoni7812 4 жыл бұрын
hello sir i writing this program by my self and what i did change the code instead of creating get_level function i pass level parameter in print_tree() method, that's decrease the line of code here it's my code def print_tree(self, level = 0): prefix = " " * level + "__|" if level != 0 else "" print(prefix, self.data) for c in self.children: c.print_tree(level + 1)
@codebasics
@codebasics 4 жыл бұрын
Nice tip actually. Yes this can make the code more compact
@tanveermahmood9422
@tanveermahmood9422 3 жыл бұрын
Love & respect fro Pakistan
@codebasics
@codebasics 3 жыл бұрын
👍😊
@songsport1917
@songsport1917 3 жыл бұрын
Молодец ❗❗❗
@joskatiyare4759
@joskatiyare4759 3 жыл бұрын
I am sure he is an expert in DSA, but I doubt if he had any biology class in school
@kingpaul40
@kingpaul40 Жыл бұрын
hello sir.... i know this tutorial is 3 years ago. hoping this is still active.... can you help me how to save the tree in a database and be able to create, insert/append, edit, and search. thanks you sir.
@anshumansinha5874
@anshumansinha5874 Жыл бұрын
Hey Dhawal. Why did you not make a different class for build tree and add methods like add_child inside that?
@tuhinmondal9735
@tuhinmondal9735 3 жыл бұрын
what child.parent does and how this type of function works can you give an example
@eugeniogonzato
@eugeniogonzato 3 жыл бұрын
Tanks for this interesting video, good job. I like to share with you what I add in my exercise: def print_all(self): colors = { '0' : '\033[38;2;255;0;0m', '1' : '\033[38;2;0;255;0m', '2' : '\033[38;2;0;0;255m', '3' : '\033[38;2;255;0;0m' } spaces = ' ' * self.get_depth() * 3 + '+' if self.parent else '-' print(colors[str(self.get_depth())] , spaces , self.data[0]) if self.children: if self.get_depth() < 3 : for ch in self.children : ch.print_all() In this way I print with different colors depend on the depth of the tree. thanks, you inpire me.
@meralmaradia4774
@meralmaradia4774 2 жыл бұрын
Hello Sir, can you please create a video developing of project using only DSA ?
Queue - Data Structures & Algorithms Tutorials In Python #8
14:20
Hoodie gets wicked makeover! 😲
00:47
Justin Flom
Рет қаралды 138 МЛН
One day.. 🙌
00:33
Celine Dept
Рет қаралды 42 МЛН
Ice Cream or Surprise Trip Around the World?
00:31
Hungry FAM
Рет қаралды 22 МЛН
Understanding B-Trees: The Data Structure Behind Modern Databases
12:39
8 patterns to solve 80% Leetcode problems
7:30
Sahil & Sarra
Рет қаралды 442 М.
Hash Table - Data Structures & Algorithms Tutorials In Python #5
17:52
Data structures: Introduction to Trees
15:50
mycodeschool
Рет қаралды 1,5 МЛН
Linked List - Data Structures & Algorithms Tutorials in Python #4
28:16
Coding Trees in Python - Computerphile
21:27
Computerphile
Рет қаралды 316 М.
Hoodie gets wicked makeover! 😲
00:47
Justin Flom
Рет қаралды 138 МЛН