Your not editing out the parts where you get confused (like with the returns in the recursive methods ) is wholesome . It’s what others don’t do . And this is a priceless lesson for everyone who has not been confronted with those kinds of problems before . Fan since started to code.
@ProBloggerWorld
Жыл бұрын
I love the reasoning and unedited display of bloopers. This gives it a human touch and is way more realistic, than pretending to get everything correct the first time. Thanks! 🙏🏻 😊
@kenhaley4
7 жыл бұрын
Dan, I think you left out the most important (and hardest) part of binary trees; namely, keeping the tree balanced. Consider, for example building a tree using the numbers from 1 to 100 in ascending order. The root node would be 1, and there would be 100 nodes none of which would have a left node. Nothing but a linked list. Balancing the tree after each insert avoids this. I wouldn't expect you to actually do tree balancing in a quick coding challenge, but I think the task should be mentioned, and should perhaps challenge us, the viewers, to work out how to do it. Or.. make it a coding challenge by itself (?)
@_javlm_
5 жыл бұрын
AVL Tree
@asubaba123
5 жыл бұрын
BST isn't balanced, AVL is
@JackFlashTech
4 жыл бұрын
Upvote because I agree, but this is the first I’d learned that a BST can be unbalanced (according to Wikipedia). Not nearly as useful without it.
@ask4144
4 жыл бұрын
It's not a AVL tree! Just a binary tree!
@TTaiiLs
4 жыл бұрын
Code for balace is ez (8 Lines), problem is run time
@Tordek
7 жыл бұрын
The pictures you saw in the image search are perfectly fine: they're pictures of binary trees; that is, trees where each node has up to two children. However, not all binary trees are binary SEARCH trees, which are ordered the way you expect. Had you searched for that instead you'd have gotten the expected results :)
@kosmic000
7 жыл бұрын
ur just amazing dan,,not just a perfect instructor but also a cheerful , kind human being
@kolozubix99
7 жыл бұрын
that look of enthusiasm in your eyes at 0:07 is absolutely amazing :D
@yungrolex1992
7 жыл бұрын
I hopped on the coding train about two weeks ago and I have been binge watching all of your videos man. You are a great, enthusiastic teacher. I looked you up and saw the Swarm project and was amazed. Thanks for teaching all of us!
@ali_gaming3190
7 жыл бұрын
Do a series on data strucrures and algorithms
@Xeronimo74
7 жыл бұрын
please?
@akashakya
6 жыл бұрын
please i beg you shiffman
@ritikkhatri
6 жыл бұрын
PLease!
@MrBuckethead911
6 жыл бұрын
AMEN TO THAT
@alexi1182
6 жыл бұрын
It'd be too late, but hell I'd get use of next semester
@steevenpetit-homme5267
7 жыл бұрын
I like the fact that I have tried to look for the bug with you, but I could not see what's wrong. I love this man . Thks!
@top1percent424
7 жыл бұрын
I love data structures and algorithms; they are so clever ideas and concepts. Love it!
@avatar098
7 жыл бұрын
To clarify, a Binary SEARCH Tree is what he is implementing. A Binary Tree in general is just a tree in which all parents have (at most) two children. The difference is that a Binary Search Tree is a special kind of Binary Tree in which the the children will either be to the left of the parent or the right depending on if the child is less than or greater than it's parent. :)
@robtvogel
7 жыл бұрын
I came to the comments for this. I also believe a binary tree is usually built to remain as closely to balanced as possible.
@-._.-KRiS-._.-
3 жыл бұрын
All children should be greater than their parents.
@EduAnmoldeep
3 жыл бұрын
@@robtvogel Same in my case, I was also expecting someone should have pointed this out :D
@wyattelliott5200
6 жыл бұрын
the recursion in visit() is dope. Only presentation on binary tree search that I've been able to listen to so far. Keep it up man
@Nxluda
2 жыл бұрын
Let's go over to the whiteboard. Immediately leaves the shot of the white board. I can't wait to learn from this man.
@vision6D
7 жыл бұрын
Inspired by the phone book example. In psychiatric hospital a doctor gave a phone book to a patient. After a week the doctor meets the patient again and asks him about the book. The patient answered, the story is not really interesting, but the number of characters is really impressive. Great job Dan love your work. Greetings from Geneva Switzerland.
@rushishah8659
7 жыл бұрын
The images you were looking at are " binary tree " which represents data structure tree with max 2 degree of nodes... the structure yoy wanna look for is " binary search tree "
@mdminhaj8567
3 жыл бұрын
Finally, I properly understand the concept of Tree from this video. I always appreciate your teaching and your attitude. You're so much helpful. Thanks for you from my heart!
@DogwafflDan
6 жыл бұрын
Thanks for the series on binary trees. We used them to sort images according to similarity. Thanks also for opening object oriented programming for me. 20 years of people telling me it was like dogs and cars didn't do the job. Seeing someone do practical examples made it so clear!
@jorgegranada4964
5 жыл бұрын
Decissions are binary. You can allways resume them as "should i do this or not". Both have consecuencies AND lead to More binary decissiones.
@euklidian-space
7 жыл бұрын
Watching you struggle through tree algorithms is endless entertainment
@mrsecify
6 жыл бұрын
I just love your enthusiasm and happiness. You are one of a few KZitemrs that actually make me giggle, even though you're not trying to be hilarious. Keep being awesome! Oh and you kind of made me come back to programming. I'm an electrical engineering student myself, but I used to code a lot when I was a kid and all the way through high school, but got burned out. So thanks for making a difference in my life! (:
@TheCodingTrain
6 жыл бұрын
Thank you!
@foolishsamurai
7 жыл бұрын
I want to know where u buy ur adrenaline from :)))))
@phuong7357
5 жыл бұрын
@@thcoura You must have a really sad life then.
@cxT9344
5 жыл бұрын
It is called passion
@manamibhunia7125
4 жыл бұрын
from Alien in the future
@HettyPatel
4 жыл бұрын
Local crack dealer
@stephenelliott7071
4 жыл бұрын
Yeah this video really needs some editing because it seems he doesn't know what he's talking about (but he does). Overall a good explaination though.
@RM-lw2qi
7 жыл бұрын
THANK YOU! You would be the perfect teacher for data structures and algorithms, please do more
@FredoCorleone
5 жыл бұрын
Aliens from the future tell you ES2015 introduced classes in JS. I really like the fact that you delegated the Node class to visit() and search() as this seems way more reasonable than putting a bunch of code within Tree class, because in the end Tree is just a wrapper while Node is a meaningful representation of a tree. As weird as it may sound.
@linashamoon9414
4 жыл бұрын
Never understood binary trees until now! This was great!!! Thank you!
@Holobrine
5 жыл бұрын
I had to a CS assignment that does math with a binary tree, with number leaves and operator inner nodes. By the way, you don’t need a tree type. When you add a node, if the root is null, you set it to the node, otherwise you recurse to the left or to the right.
@corey333p
4 жыл бұрын
I like how the BST you randomly made just happened to be balanced. That is, there is no node such that |depth right - depth left| > 1
@siba2893
6 жыл бұрын
Hey Dan, I love your coding tutorials and coding challenges they actually teach a lot. But I believe you left a really important thing outside this binary trees and thats Balancing the trees.
@TheCodingTrain
6 жыл бұрын
Great point!
@Mezklador
7 жыл бұрын
Congratulation Mr. Shifman: you've made it! I finally get it about binary trees logic and why it's so useful in sorted algorythm...
@iamamcnea
7 жыл бұрын
@The Coding Tree Referencing 21:26, the console.log shows the state of the object when the object is expanded in the console, not the state of the object when it is logged to the console. You need to do something like serialize the object to a string and console.log() the string to get the state of the object at the time the object is logged. I usually use JSON.stringify().
@brunoandradebr
7 жыл бұрын
It's important when implementing pathfinding for games. Find the shortest path to a certain point, for example. great explanation! thanks!
@DaveAkumu
7 жыл бұрын
When I was watching one of your videos for the first time I thought: "Who is this crazy guy and why is he so happy all the time?" In all honesty I didn't really like you but then I watched some more of your videos and now I'm subscribed. I like to watch your videos when I'm programming because its really relaxing. Keep up the good work! Really looking forward for more videos. :)
@TheCodingTrain
7 жыл бұрын
Hah, thanks for the feedback!
@simon13751
3 жыл бұрын
@@TheCodingTrain always happy guy😅
@matthewsnell3789
7 жыл бұрын
A series or a video on coding a simple Gerrymandering Algorithm would be amazing!
@MrBidalos
7 жыл бұрын
I'm learning C, and this is in JS which I don't know at all. But I understand clearly what he is doing. Also from his videos I started to understand what is OOP!
@NinjaKyou
7 жыл бұрын
Can you do a series on data structures an algorithms?
@andachain
4 жыл бұрын
sorry, What?!!
@user-vx1wt4hb5l
4 жыл бұрын
@@andachain Lol idk either
@Tuberex
4 жыл бұрын
your name
@user-vx1wt4hb5l
4 жыл бұрын
@@Tuberex What's wrong with my name?
@user-vx1wt4hb5l
4 жыл бұрын
jk im not whoosh bait
@mohammedabahussain4562
4 жыл бұрын
Dude, I really like your bow tie!
@paulgirard3093
7 жыл бұрын
Always cool to learn from a good teacher AND from his mistakes^^
@TalymoMakes
3 жыл бұрын
The traversal method he is using is the "In order" transversal, which will return the numbers sorted. You can also do a "pre order", "post order", and level order. :)
@loganmahoney2284
5 жыл бұрын
You're like the Bob Villa of programming and I love it
@paladin1147
5 жыл бұрын
This really helps with understanding recurssion more indepth, atleast for me xD. This is awesome. Thank you Mr. Shiffman for this video.
@gauravmaddesia6546
3 жыл бұрын
I love his enthusiasm
@paclion9345
7 жыл бұрын
Wow this channel is amazing, just discovered it
@TheCodingTrain
7 жыл бұрын
Welcome!
@amdreallyfast
6 жыл бұрын
I've used a variation on binary trees for collision handling. They have their uses :). In early August I finished an ~1.5yr long project for a rough visualization of several thousand particles colliding in real time. It used compute shaders on my graphics card and handled large-scale collisions in O(log(n)) time through a variation of a binary tree called a "bounding volume hierarchy". It was rather cool (after I managed to dig through the academic papers with the algorithms).
@leeritenour
6 жыл бұрын
An excellent mistake at the end that brings up a very good practice: maintain reliable returns for recursive function calls. Thank you for the lesson!
@nackyding
6 жыл бұрын
Thank you! Excellent! Looking forward to part 2. Thanks again. You teach/explain really well. Can you please do a complete series on data structures and algorithms?
@lewisshemery2585
7 жыл бұрын
This what I need! I have code that uses A* to solve 8-puzzle. It uses java's built in priority queue to hold node successors and a comparator to keep them sorted. I want to try and write something like that on my own and this seems like a great way to do it!
@benjaminphilippe2810
7 жыл бұрын
I know what a phone book is! It's a book full of phones (DUH!). So when you need a new phone, just find in in the phone book! (right?)
@xynyde0
6 жыл бұрын
😅
@Tuberex
4 жыл бұрын
your stupid phone book is a book that contains photos of every phones you cant just pull them out!
@angelcaru
3 жыл бұрын
@@Tuberex r/woooosh
@anon_y_mousse
2 жыл бұрын
This was a funny parody of a newbie programmer implementing their first BST. I'm surprised you didn't put it out on April 1st of that year.
@ridespirals
6 жыл бұрын
you can pass as many arguments to console log as you want, it'll even put spaces between strings for you and print objects nicely
@minecraftermad
5 жыл бұрын
This can be used for datapacking if instead of smaller or larger numbers use the commodity of the item and the more common it is the higher it is now 1 or 0 will be left or right and boom most efficient datapacking without a separate library
@nightcoder5k
Жыл бұрын
I had a lot of fun doing this in college using Pascal on SunOS 3.x.
@shrutigupta445
3 жыл бұрын
"Insert one direction music" - i know i have the right idol. More power to you, Dan!
@eduardohidalgo5260
7 жыл бұрын
Please Coding challenge: how to draw binary tree (or ternary or other subtypes), and how to draw graph! It would be amazing learn how it visually looks like graphs and trees. I love your videos (: A viewer from Cancun, Mexico.
@medAmineRg
3 жыл бұрын
you make binary search looks easy thankyou so much sir!!!
@Linkario86
2 жыл бұрын
It's better explained than I ever heard, and I'm kinda happy you struggle yourself at times. No offense, it just makes me feel a bit less stupid.
@TheCodingTrain
2 жыл бұрын
That's the idea!
@rozarasinvestments880
6 жыл бұрын
I love this guy! Better to be entertaining and unpolished
@sinyolinuxozy
7 жыл бұрын
Nice explanation sir, do a data structures and algorithms series, please :)
@PedroPauloAlmeida0
4 жыл бұрын
Why not use a Linter to avoid all those small bugs? Anyway, thank you for your effort. PS: you can use "comma" in console log: `console.log('Found', someObject);`
it's hilarious how he speaks to us like we're waaaay in the future
@alekmoth
7 жыл бұрын
UP ARROW to repeat commands in the console!!
@Kitulous
6 жыл бұрын
alekmoth 36:51 he knows, right? He didn't use that because the numbers are different each time.
@Kitulous
5 жыл бұрын
omg I didn't even know I watched that video 11 months ago!
@NocturnalCoder
5 жыл бұрын
The first time some ancient video mentions a proper explanation of phone book and phone number!
@Eresea
6 жыл бұрын
Hi, very cool videos it's an awesome way to learn interesting programming concepts. On the topic of tree structures I was wondering if you could do a video on a QuadTree implementation to show spacial distribution. I'm using QuadTrees on procedural planet generations in games and found it very challenging but interesting. Thanks !
@TheCodingTrain
6 жыл бұрын
Please suggest or upvote here! github.com/CodingTrain/Rainbow-Topics/issues I definitely want to tackle this.
@leeritenour
6 жыл бұрын
Your videos are educational and joyful. Thank you for the lectures.
@cadenricker7475
6 жыл бұрын
Yo Daniel try only using one return statement and just assign a variable to what you want to return and return the variable it will make your code simpler and easier to debug and update.
@tagaiismailov4235
3 жыл бұрын
Please, we really need a series on Data structures and Algorithms by Shiffman
@SurrealBackrooms
3 жыл бұрын
Instructions Unclear: Created a book made of phones
@MikeMcRoberts
7 жыл бұрын
I challenge you to create a star map based on real star coordinates, converting RA & DEC coordinates to screen coordinates.
@ArvindhMani
7 жыл бұрын
Every time i hear "ting" I laugh like a little kid. LOL!
@alifakhbarnizam5287
3 жыл бұрын
the presentation so colorful, guess you are from the unicorn tribe!
@chungyunlee3832
7 жыл бұрын
Really like the way you talk about programming : )
@anteconfig5391
5 жыл бұрын
I love learning new algorithms.
@chrisw3260
7 жыл бұрын
First of all, great video, absolutely love your enthusiam!! I'm having issues understanding the visit()-function though, to a point where it is driving me crazy, maybe someone can enlighten me. Here's how i understood the code: Taking Dans first tree with the numbers 3,5,6,7, 5 would be the root, 3 & 7 to the left and right of 5 and 6 to the left of 7. Now tree.traverse() is called, which itself calles the visit()-function on the root-node with the value of 5. visit() then checks, if a left node is present (which it is, with value 3), calls itself again on the node with value 3 (executing this.left.visit()) and checks, whether THIS node has another node present to the left, which is NOT the case, so it skips the first if-statement and prints the value 3. Following the code, the second if-statement is skipped, because there is also no right node (this.right != null is false). At this point, i would assume, the visit()-function is at its end, how are the following nodes visited? Somehow the code must jump to the node containing the value 5 and then to the ones with 6 and 7, to print them all in order, but i just don't get how. Somewhere, my explanation must be horribly wrong.. Any explanation is highly appreciated.
@sreeramchittela399
6 жыл бұрын
It's a recursive call dude. it uses stack. So, when it doesn't meet any relevant condition, then it goes back to the previous node.
@Mariovg99
5 жыл бұрын
You dont need a datatype Node, its easier to assume a BS Tree as a root with a left and right BS Trees, which is the mathemathical definition.
@gui1542
7 жыл бұрын
Holy crap, Grokking Algorithims is awesome!
@evieeve1571
7 жыл бұрын
Guilherme Marthe is it free?
@micky2be
4 жыл бұрын
OMG, I'm telling at the screen "you have to return the result!!!"
@ThePikachu00200
7 жыл бұрын
In the next video you should also add a function to remove a node! I recently had to implement my own binary search tree for a class and removing can be quite difficult in java, I would like to see if it is just as hard in JavaScript.
@manojbhatti3601
6 жыл бұрын
Please do a series on data structures
@ghulamhyder2628
4 жыл бұрын
Love you Daniel ❤️
@christiantith2843
5 жыл бұрын
Bill Nye of CS vibe , I dig it
@WhisperVT
7 жыл бұрын
Saw this topic and immediately shivered lol. Not my favorite part of data structures...
@Texplanations
7 жыл бұрын
Hey dan! Here's a quick Idea.... Cutout the word rain from paper and then stick it on top of your bow.... It'll be good :3
@jan_harald
7 жыл бұрын
that's so easy and common that I'm 16 and I've already seen that about 5 times and I'm not even doing anything related to it..,not doing anything at all, actually, but kinda learning programming... I love phone books and Compact Disks
@matterno
7 жыл бұрын
I used to code like this back in the student days... Nowadays I am developing test driven and produce more reliable code.
@TheDsixer
5 жыл бұрын
I keep switching back and forth between brackets, index.html, and this video. For like the third time i have hit f5 on this video to try to make it play or refresh my web page.
@robertphillips124714
2 жыл бұрын
At 5:40 was anyone else shouting at the screen, "you have a whole book of random numbers right there!!"
@gaurangbansal8735
6 жыл бұрын
Sir,please do a series on graph problems and approach for competitive programming
@adomasz.3958
7 жыл бұрын
I don't know why I love this video so much :D
@yalcinozer4434
2 жыл бұрын
I have learned a lot thanks. I also realized my solutions are rubbish. Need to be improved
@pucbg2902
5 жыл бұрын
Sir Will you please START JS WITH UNITY because I love your teaching skill and programming skill. When Sir you will start unity there will new world appearing
@vontrae
2 жыл бұрын
I chuckled at the node.js one hahaha
@BrianFaure1
6 жыл бұрын
Anyone interested in a Python implementation, feel free to check out my recent lesson: kzitem.info/news/bejne/x2uau2euqHdnoKg
@christoffaloffagus9713
7 жыл бұрын
I was confused about prototype, but now I have translated the binary tree search from your code to python I see it is basically a function inside a class (in python terms anyway). I'm still new to coding in general so hopefully someone will correct me if I'm wrong.
@edvaned8207
Жыл бұрын
great class! 😎😎😍😍😍😍
@artificialhuman3260
6 жыл бұрын
i love this man so much
@critstixdarkspear5375
5 жыл бұрын
All praise this.
@Egli
6 жыл бұрын
Duuuuuuuuude u are amazing!!!! Love your work first time ive seeen any of your videos and incan already tell ur an amazing teacher!!
@fezekileplaatyi7224
3 жыл бұрын
Thanks a lot brother!
@zid3
5 жыл бұрын
A little late to the party but thank you for making this video, it helped a lot more than these academic books hah. Into my second year and just started algorithms and data structures, very interesting but mind numbing at times 😊. This video was fun to watch and helped me understand binary search trees. Thank you!
@andrewgluck8740
7 жыл бұрын
Well, as of writing this I am one day in the future. So I am well versed in the technologies that you are describing. ^.^
@conwear2544
7 жыл бұрын
Why do we need to return the function calls in the search function? I don't understand.
@3liflo
7 жыл бұрын
from my understanding (hope this make sense lol also I could be completely wrong) every time a value is returned it is returned to whatever directly called it. You can't make indirect returns so the solution to returning indirect values is to return the value to its previous call in a chain until its returned to the direct function initialization. So when the search function is initially called it checks its value to the root value and if they are the same then THAT value/node is returned if not then the value is returned at the node it is found but not to the initial function call instead its returned to the previous one and then that value is returned to the previous one before that and so on but it will never be returned in the console because the final return to the initial call doesn't exist as you can probably tell this chain of returns did take place but never completed to the first call which is why he needed the return calls in the "this.left.search(val)" and the "this.right.search(val)' to make the final return call to the variable found in the "tree.prototype.search" hope that made sense!
Пікірлер: 401