Тёмный

Data structures: Binary Tree 

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

See complete series on data structures here:
• Data structures
In this lesson, we have discussed binary tree in detail. We have talked about different types of binary tree like "complete binary tree", "perfect binary tree" and "balanced binary tree" and their properties. We have also discussed how cost of operations in a tree may depend upon height of the tree and why we want a tree to be dense and its height to be minimum. Finally, we talked about two possible implementations of binary tree - a) using dynamically created nodes and b) using arrays.
For practice problems and more, visit: www.mycodeschool.com
Like us on Facebook: / mycodeschool
Follow us on twitter: / mycodeschool

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

 

16 янв 2014

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 383   
@saikumar555
@saikumar555 4 года назад
Felt very sad that the guy who was founder of these courses passed away on June 2014 . in a car accident! but he is alive with his videos!!! RIP !! :(
@nicolasgoosen5142
@nicolasgoosen5142 3 года назад
Yes, they're fantastically dense full of info and comprehensive.
@aakashdharmakari2591
@aakashdharmakari2591 3 года назад
how do you know this? who is running the channel now, cuz the last video on this channel is 4 years old.... please reply I really wanna know the answers.....
@findoc9282
@findoc9282 3 года назад
he always live in our heart, never be forgot. Every moment we get inspired in some moment in the future
@rchtchauhan
@rchtchauhan 3 года назад
@@qq3801 thanks buddy for this
@MinaTheSmallYoutuber
@MinaTheSmallYoutuber 3 года назад
sad to hear that. RIP
@eshaan7_
@eshaan7_ 5 лет назад
If anyone is having confusion between depth and height, think of the analogy that we measure the 'depth' of sea from it's surface and the 'height' of a person from toe to head. PS: This was taken from a stackoverflow thread.
@nareshramini1796
@nareshramini1796 4 года назад
I'm still confused about height and depth of a tree!
@satyajitchandankar418
@satyajitchandankar418 4 года назад
what do you mean!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
@thewatcherlollol
@thewatcherlollol 4 года назад
stole this right off of Stackoverflow. Credit the person smh.
@dhruvgaba8516
@dhruvgaba8516 4 года назад
Let's imagine an example of a fish swimming in the sea. Here, fish resembles a node, and the height of the fish from the sea bed resembles the height of the node and the depth of the fish from the surface of the sea resembles the depth of the node. Have a look at the diagram below: _ _ _ _ _ _ _ _ _ _ _ _ _ == surface (root node) | | == Depth from the surface of the sea (if there are d no. of edges to get to node x) | ((*)) === Fish Any particular node (x) | | == Height from the bottom of the sea (if there are h no. of edges from the bottom-most leaf) | _ _ _ _ _ _ _ _ _ _ _ _ _ == sea bed (leaves, end of tree)
@akshaysolanki4340
@akshaysolanki4340 4 года назад
Eshaan thanks for sharing
@TheTahlia1988
@TheTahlia1988 8 лет назад
I cannot thank you enough for this playlist on Data Structures! Keep up the good work :)
@yashchandraverma3131
@yashchandraverma3131 6 лет назад
I click on every ads that you show because you are teaching me well and it is my duty to give some money from ads to you. Thanks mycodeschool.
@blackflame_
@blackflame_ 5 лет назад
He passed away..
@lyfokzz3848
@lyfokzz3848 5 лет назад
@@blackflame_ his friend passed away...
@blackflame_
@blackflame_ 5 лет назад
@@lyfokzz3848 Whoever he was I owe him for helping me clear my courses
@lyfokzz3848
@lyfokzz3848 5 лет назад
@@blackflame_ yup...some of the real IT/CS people will understand his work!
@shahriarmim4696
@shahriarmim4696 5 лет назад
It's the cofounder Animesh Nayan. And I think he doesn't need anyone's money. And death happened to Late Harsha who was also a managing member of MyCodeSchool. Read this: blog.mycodeschool.com/2013/12/the-story-of-mycodeschool.html?view=classic
@nicolasgoosen5142
@nicolasgoosen5142 3 года назад
This is an awesome series - even 7 years later!
@sourabhdattawad9244
@sourabhdattawad9244 8 лет назад
Best data structures tutorial around the web. Thanks for enlightening!
@josedubois2295
@josedubois2295 9 лет назад
You are an amazing teacher thank you so much for helping me understand these topics more completely.
@renon3359
@renon3359 5 лет назад
Hands down best videos on the net for Data Structure. Awesome work man.
@akumasdeception
@akumasdeception 3 года назад
This is a masterpiece, thank you so much for the job that you're doing!
@learningisjoy8613
@learningisjoy8613 9 лет назад
Thanks for your hardwork...you did awesome job that benefit many students like me...Thumbs up and keep on sharing.
@mycodeschool
@mycodeschool 9 лет назад
Jamyang Tashi Thans a lot :)
@sersuplado1354
@sersuplado1354 4 года назад
J
@maryjaneponcedeleon4372
@maryjaneponcedeleon4372 4 года назад
🙌🏻
@Dhruv-jf1ho
@Dhruv-jf1ho 3 года назад
@@mycodeschool Helped me in 2020
@anveshreddypinnapareddy3552
@anveshreddypinnapareddy3552 3 года назад
@@Dhruv-jf1ho yeah, always has been 🙌
@RebeliousSapien
@RebeliousSapien 2 года назад
oh my god this was so helpful. i've read so much content about trees and watched so many videos that always left me even more confused. But THIS ... this was just perfect and extremely well explained. thank you so much for making this video.
@krishnasingh4434
@krishnasingh4434 3 года назад
Sir you are the best teacher I have seen on RU-vid you teach in such a simple way 🙏
@mycodeschool
@mycodeschool 10 лет назад
Here is the next video - Data structures: Binary Search Tree
@nishant73391
@nishant73391 8 лет назад
+mycodeschool at 13:20 you show the height of the left child of root is 2. The height of left child of 2 is 0 here not 1. so how the height is 2?
@sambitsarkar6987
@sambitsarkar6987 8 лет назад
+NISHANT NIKET You are right. The height of the left child of 2 is 1 and not 0. But we are talking about the abs difference between the height of left and right sub tree. So, lheight = 1, Rheight = 1, lheight - Rheight = 0. Hope this helps!!
@cafafans
@cafafans 4 года назад
I have been watching this video since 2015 and I never get tired even on this 2019. Thank you so much for this wonderful work.
@rohithpokala
@rohithpokala 4 года назад
@@cafafans me too
@DOOREO
@DOOREO 4 года назад
mycodeschool ahhhhh.. I see!! *pointer to “the next video”...... GENIUS teachings
@anurakboonyaritpanit9129
@anurakboonyaritpanit9129 9 лет назад
thank you mycodeschool for good and free video tutorial. it is a complete data structure. help me understand outside my class.
@rajatnarlawar
@rajatnarlawar 9 лет назад
u teach very well...finding it easy cuz of u..:)
@asishraz6173
@asishraz6173 4 года назад
Lots and lots of information in just one video. Thank you so much for your effort and dedication towards sharing this valuable piece of information. Keep up the great work.
@georgioskyritsis2929
@georgioskyritsis2929 9 лет назад
The best explanation i've ever seen. Thank you!
@khubaibraza8446
@khubaibraza8446 7 лет назад
Best teacher of data Structure I have ever seeen .. Salute your efforts and hardwork ...
@premalathak6748
@premalathak6748 9 лет назад
Thank you so much for wonderful video with the subtitles. Finally,now i can understand what a binary tree is.
@mxkep
@mxkep 7 лет назад
All your data structures videos are great ! Thank you so much!
@aditipatil7377
@aditipatil7377 8 лет назад
hats off to u sir ! ur videos r life savers ! helped me alot during my dsa viva !! u r truly great teacher ! :))
@Dylanbforthree
@Dylanbforthree 9 лет назад
Awesome videos, keep up with adding the captions please!!! Makes it so easy to follow along, great tutorial!
@vivekk232
@vivekk232 7 лет назад
excellent sir....& lots of thanks to help me as such easy language to learn tree...I appreciate u sir
@WiseFatOwl
@WiseFatOwl 5 лет назад
Thanks a lot for this data structure playlist! A life saver if u ask me.. I know I know i'm pretty late.. but still thanks again!
@hitesh123ism
@hitesh123ism 5 лет назад
Best lecture on a binary tree so far.
@1276stella
@1276stella 9 лет назад
Thank you for your videos! I learn a lot from them and I will continue watching.
@mayankpratapsingh5256
@mayankpratapsingh5256 9 лет назад
mycodeschool is doing an awesome work.... Keep going ..
@gigachad6844
@gigachad6844 2 года назад
Guys there also exists a different version ACBT = Complete Binary Tree of mycodeschool Complete BT = Perfect Binary Tree of mycodeschool While Full/Strict/Proper and Perfect BT all are same.
@prakrutijani4205
@prakrutijani4205 4 года назад
Excellent even after 5 years..Thank you
@VIKASHKUMAR-qt7pk
@VIKASHKUMAR-qt7pk 5 лет назад
thanks to making such a nice tutorial it will covers all necessary information to starting binary tree. thanks again.
@abhilashbss9059
@abhilashbss9059 8 лет назад
fantastic work .... very easy n smooth take over
@PratikShende91
@PratikShende91 10 лет назад
realy helpin in improvin concepts.....voice is clear ... thanks for the videos...learnin DS with ease.
@abdelrhmanahmed1378
@abdelrhmanahmed1378 3 года назад
tree can be implemented using arrays if tree is perfect binary tree not just complete . and your are one of the best in cs topics on the entire internet ,keep uppp
@ayushgp1
@ayushgp1 9 лет назад
Awesome Channel! This is the best explaination i came across atleast for linked lists!
@saikumarnallagangula
@saikumarnallagangula 10 лет назад
thank you so much for the videos. I have never thought that I would learn DataStructures with so ease. Really loved each and every video(content, concepts and the way of teaching). Eagerly waiting for other Concepts of DataStructure and Specially Trees and Graphs. Hope you would continue with many more.
@ajaytillu
@ajaytillu 10 лет назад
rey bujji chadavalekapothunnam ra
@bishnudas3562
@bishnudas3562 3 года назад
Its 2021 but still the best playlist on Tree DS on youtube
@OmarFaruk-nw7rq
@OmarFaruk-nw7rq 6 лет назад
the series in the description is very helpful . thanks
@ashfaqtunio1311
@ashfaqtunio1311 8 лет назад
Excellent! Explained very well. Thanks for these videos
@TheSteak1984
@TheSteak1984 9 лет назад
Great tutorials. Thank you.
@ewanmcdonnell6990
@ewanmcdonnell6990 9 лет назад
Thank you for your good explanation.
@wandererstraining
@wandererstraining 2 года назад
This was a mind-blowingly good video! Glad I decided to redo my math as I started watching the first videos of this playlist. Knew it would come in handy. I'm very thankful these videos were made, and wish their creator was still alive to see how many people they help.
@paula19335
@paula19335 Год назад
Can you pls tell me what math do I need to learn to be able to understand this? Your answer would really help me
@wandererstraining
@wandererstraining Год назад
@@paula19335 Just regular high school math. Exponents, square roots, logarithms. It's nit so much about a very specific part of it as it is about observing and applying mathematical thinking.
@shreyashjoshi4188
@shreyashjoshi4188 5 лет назад
Your tutorials are just awesome man.
@md-ayaz
@md-ayaz 8 лет назад
Instead of thanking him on comment section. You could white list his channel on Ad-block ( if you are using one).
@GauravSehrawat8888
@GauravSehrawat8888 10 лет назад
Just too Good.. Awesome concepts . Channel will be popular soon !!
@attamalik6360
@attamalik6360 8 лет назад
awesome way of teaching
@qaziahmed9850
@qaziahmed9850 8 лет назад
Thanks a lot sir yoh have good job and great effect in this way to help students whose want to increase the knoweldge wd conpect.
@TheFlyguy31
@TheFlyguy31 7 лет назад
Brilliant explanation of the Binary Tree
@docuscientifique
@docuscientifique 10 лет назад
You saved my life :) I love you :)
@souravpati2007
@souravpati2007 10 лет назад
Your explanation is clear and adequate , is it possible to discuss the implementation in java ? especially implementing the linked list class. Thanks !
@JeshOrquina
@JeshOrquina 9 лет назад
Do you have any tutorials on threaded binary trees? Is there any possibility you could make one? I have trouble understanding it in class and your tutorials have been very useful to me so it would be great if you could make one. Thanks!
@shriyanshgupta8738
@shriyanshgupta8738 9 лет назад
thanks for teaching in a simple language...
@ketkidavda8588
@ketkidavda8588 7 лет назад
this is awesome !!! youre a very good teacher :) thanks
@usama57926
@usama57926 6 лет назад
bro your explanation is amazing
@ImranAliyev
@ImranAliyev 6 лет назад
Excellent explanation!!!
@afterworkguinness2452
@afterworkguinness2452 8 лет назад
Excellent tutorial!
@Anoopegi
@Anoopegi 9 лет назад
i love ur tutorial and i think they are best
@ONIscrooge
@ONIscrooge Год назад
Incredibly helpful, thank you.
@philtrem
@philtrem 8 лет назад
These videos are fantastic, thanks a bunch!
@SonuSonu-tk5pk
@SonuSonu-tk5pk 7 лет назад
why dont u go to ur country and study
@philtrem
@philtrem 7 лет назад
o.Ô
@saurabhshah8802
@saurabhshah8802 6 лет назад
Haha. What's wrong with you man? Its RU-vid. Its free and available to all.
@kookiespace
@kookiespace 9 лет назад
Your videos are amazing!
@sagarshah275
@sagarshah275 9 лет назад
Your videos are excellent...thanks a lot.
@AbhayKulshrestha
@AbhayKulshrestha 9 лет назад
Very nicely done, thanks for sharing this one for us :)
@sindhu1345
@sindhu1345 7 лет назад
amazing job, this is really helpful, thank you ☺😊
@ZYKLONEITSolutions
@ZYKLONEITSolutions 9 лет назад
Good Work !! Thank You !
@gabrielpereiramendes3463
@gabrielpereiramendes3463 5 лет назад
Great lesson. Very good!
@LAnonHubbard
@LAnonHubbard 8 лет назад
This is very clear, thank you.
@jasonavina8274
@jasonavina8274 4 года назад
that advertisement for charity : water was the best ad i've ever seen. it feel like a changed person and im not even kidding.
@lorimemontanes8950
@lorimemontanes8950 2 года назад
Hi. I am one of your subscriber, been following you for a couple of months. Can i possibly use this as a reference in our class, seems like you do have a very clear way of explaining. Thankyouuu.
@dipaktandel629
@dipaktandel629 9 лет назад
Great work by u people....!!!!
@TricoliciSerghei
@TricoliciSerghei Год назад
Wonderful content, thank you very much.
@rhinethetauren
@rhinethetauren 3 года назад
Great lesson. The log stuff threw me off, but I just need to review all that anyway
@TheGrimReaper0101
@TheGrimReaper0101 10 лет назад
went through all videos of this play list and hats off guyz .. awesome work.. eagerly waiting for more videos ..
@mycodeschool
@mycodeschool 10 лет назад
Thanks Nitin Kapoor , We will be adding at least 2 videos in this series every week.
@mycodeschool
@mycodeschool 10 лет назад
Nitin, Here is the next video Data structures: Binary Search Tree
@TheGrimReaper0101
@TheGrimReaper0101 10 лет назад
thanks mycodeschool . awesome one again .
@CuriousAnonDev
@CuriousAnonDev Год назад
​@@mycodeschool its been 8 years sir, please complete the play list :(((
@sweetgalleryloveperez910
@sweetgalleryloveperez910 9 лет назад
Thank you for this video coz I learn more:)
@AkifMasnoon
@AkifMasnoon 4 года назад
amazing content, really loved it :)
@chiranjeeveemohapatra
@chiranjeeveemohapatra Год назад
for node2 at 12:51 , you mentioned diff = |1-(-1) | But Shouldn't it be |2-0| ? Left subtree has height 2 and right as 0... 0 because we still have node 2 and it's not empty node. The difference is 2 anyway.
@PrabhuGunaDeepakPallikonda
@PrabhuGunaDeepakPallikonda Год назад
Exactly my doubt!!! Thank you for confirming !!!
@PrashantKumar-qk3ew
@PrashantKumar-qk3ew 8 лет назад
I want to provide a suggestion that when you write at down of the board it gets hidden by the words displaying above it. Mind it please, it will further enhance your work and thanx for providing the best.😊
@grizzlybear5701
@grizzlybear5701 9 лет назад
Thank you very much.
@mahmoudabdulhady8516
@mahmoudabdulhady8516 5 лет назад
your are very clever and accurate person
@mortysanchez361
@mortysanchez361 6 лет назад
thanks for the quality videos.
@harin.g6806
@harin.g6806 5 лет назад
perfect . Thank you very much.
@ChildofDestiny22
@ChildofDestiny22 7 лет назад
Would you do AVL, RBT, and 2-3 tree? Your tutorials are awesome!
@buzzfeedRED
@buzzfeedRED 5 лет назад
@mycodeschool Awesome work
@MVK-eo7gg
@MVK-eo7gg 4 года назад
@13:08 How is the height of left sub tree -1? I think it should be 2, right?
@smitatripathi3085
@smitatripathi3085 5 лет назад
Thnqq u sir ,this video is very usefullll,,thnqqqq uuuu soooooo muchhhhhhhhhhh☺☺
@dilrubakose
@dilrubakose 7 лет назад
You are such an amazing person thanks a lot :)
@matttukacs
@matttukacs 5 лет назад
Based on this it would be safe to assume that using timestamp based primary keys is not a good idea in mysql? It uses b-trees for storing indexes. With id based indices you are essentially constantly building a linked list that mysql has to rebalance in the background. On a very hot table this would result in a lot of extra work necessary to keep read speed reasonable.
@tonmoyacharjee2491
@tonmoyacharjee2491 9 лет назад
very helpful, thanks...
@chiragjain1424
@chiragjain1424 3 года назад
you are best brother
@krishnakandula6587
@krishnakandula6587 4 года назад
Great tut
@TheOverAndAround
@TheOverAndAround 10 лет назад
at 13:04 I am confused how you say the height of left subtree is 1? I thought it was 2. Say node x is the one in red. I watched the previous vid and it says, the height of x is the number of edges in the longest path of x to a leaf. I counted 2? I look at it this way to make it easier. if left subtree has no edge - height = 0 if right subtreee has no edge - height = 0 if left or right subtree has an edge, add up all the edges leading to the deepest leaf node then use your formula diff = | leftsubtree_height - rightsubtree_height |
@mycodeschool
@mycodeschool 10 лет назад
Matt Stewart - We are saying height of left and right subtrees. Height is defined as number of edges in some longest path from root to a leaf. For the sub-trees, the root node is not the node marked in red. For left subtree, root node is the left child and for right sub-tree root node is the right child. We need to calculate from root of the respective subtrees. Let me know if this is still not clear to you. Actually, you can calculate the diff, by saying 0 height if there is no child. Actual diff wont change. Lot of people do that. That's ok.. But when we say subtree, we cannot count the node (marked in red here) itself.
@TheOverAndAround
@TheOverAndAround 10 лет назад
mycodeschool thanks so much, that makes sense, I didn't understand where the subtree started.Learning alot from your clear vids.
@simonetruglia
@simonetruglia 10 лет назад
Matt Stewart Thanks for the question :)
@GauravTayal26
@GauravTayal26 6 лет назад
Still not clear. Height of left subtree is 2 and not 1 since there are 2 edges from root of left sub-tree to the leaf while chosing longest path. Please clarify
@prashanttrar9599
@prashanttrar9599 6 лет назад
Height of the left subtree means counting no. of edges starting from the left node and not from the base root itself, maximum no. of edges from left node to the leaf node is 1 hence, height of left subtree is 1. Consider it as a new temporary tree of which base root is the left node and just calculate height of it.
@kritin.l5872
@kritin.l5872 2 года назад
Excellent. Master !
@kaushikdr
@kaushikdr 4 года назад
The height is the maximum depth of a leaf node in the graph! Height and depth can be the same when a node has as many ancestors as descendants :)
@srinivasgatla388
@srinivasgatla388 2 года назад
Nice one bro
@neelpatel122
@neelpatel122 5 лет назад
Great stuff
@premalathak6748
@premalathak6748 9 лет назад
please teach redblack tree and splay trees.
@otobonoah7955
@otobonoah7955 2 года назад
very interesting tutorial
@saiavinashduddupudi8975
@saiavinashduddupudi8975 8 лет назад
@mycodeschool A Small Correction:- Maximum no of nodes in a complete binary tree with height h is 2^(no. of levels+1) - 1. In the video it is written as 2^(no of levels) - 1.
@MuhammadRizkyEkaArlin
@MuhammadRizkyEkaArlin 8 лет назад
+saiavinash duddupudi i think you are mistaken. No. of levels is equal to height + 1.
@AnubhavMadhav
@AnubhavMadhav 5 лет назад
WoW....very nice video Thanks
@ductive
@ductive 7 месяцев назад
12:00 I think if we say that height of a tree is the number of nodes on the longest downward path minus 1. we would avoid this possible confusion.
@tejaswininandan7025
@tejaswininandan7025 5 лет назад
Ur videos r awesome.......... But one simple request........can u plz put that subtitles little down coz we can't see what is written on bottom of the board
@minhnguyennhat5112
@minhnguyennhat5112 6 лет назад
Thank you very much for your work. This channel is a fucking gold mine!!!
Далее
Data structures: Binary Search Tree
19:28
Просмотров 1,3 млн
Data structures: Introduction to Trees
15:50
Просмотров 1,4 млн
Water powered timers hidden in public restrooms
13:12
Просмотров 515 тыс.
Binary Trees - Data Structures Explained
10:18
Просмотров 121 тыс.
What Is a Binary Heap?
8:45
Просмотров 184 тыс.
Hash Tables and Hash Functions
13:56
Просмотров 1,5 млн
2.6.3 Heap - Heap Sort - Heapify - Priority Queues
51:08
Binary search tree - Implementation in C/C++
18:36
Просмотров 1,3 млн
Binary tree traversal: Preorder, Inorder, Postorder
14:29