 So one of the new data types that we're going to start introducing is something that we classify as a tree and The entire principle behind this if we've looked at what we're what we've been talking about so far We go all the way back to our intro courses. We remember we learned about something called an array right, it's just a sequence of numbers in some collection and we actually started to expand on that as we started to get into sort of lists and linked lists really Linked list is just an implementation of that list, but what we kind of added to this was there's no inherent kind of connection to say for example These elements except for well now that's a little rambling. I would say There's no actual kind of Memory purpose like the array we were we learned is very explicitly stored in memory in a very sequential order But if we kind of abstract that concept, we don't need that in say something like a list, you know I do maybe have some different implementations of this like stacks cues and whatnot so now we get into this idea of a tree and the big principle that we start to expand on with lists and linked lists is this idea of a parent Child Connection and this is a little bit different than inheritance, you know an inheritance a an object could inherit from say its parent class It's the same when we actually sort of same in different at the same time when we would show you some UML diagrams Say for example, you see those constantly in kind of textbooks everywhere. We're showing you a parent child Tree, we're actually showing you the hierarchy of kind of how that stuff is represented And so that's sort of what we're kind of doing if say for example, I were to open up Just my my own personal computer We actually see very similar approaches. Here's my C drive for example, and if I just dig into say Windows We see that I get more folders and those folders in turn Have their own folders and files We can actually kind of look at this in a very similar manner that say for example This in us is a child of app app patch Which is a child of windows, which is a child of my C drive This is actually sort of where we start to learn some of the vocabulary terms So this element right here that I'm kind of I just happened to conveniently have Visible This is a node inside of our tree But since it's you notice it's there's nothing Passed it really is what we would classify as our Roots very similar to the C drive or so the C drive on your windows machines or just Root on your Linux and Unix devices But as we start to expand downward from that we do have a few different vocabulary terms So one of the things you might notice is from my route I happen to have some children so a is the parent of B C and D now B and C you notice they continue to expand but D has no children He ain't got no kids and what we actually classify this as is a leaf node You ask why not root well roots actually here So it's you know imagine your tree was flipped upside down. That's kind of the best way I would kind of classify this But since that the reason why it's a leaf node is again because it has no children since for example B F C These all have and I'll even kind of point at them And I'll let me change colors since B a C and F all have children we actually classify those as internal nodes Another way you could think about this if you want to use kind of more technical terms and maybe the leaf analogy is not working for you this is Also considered an external Node and so we can start to expand on this with a few more definitional terms that are kind of important So say for example this family that I have going on here. I'll just kind of circle it out So one of the interesting things about any tree is that it can actually be represented with a collection of subtrees And if we think about that analogy again of are you that analogy again of my my File hierarchy on my computer Very similar My current folder my root folder is just a collection of folders if I have folders and files If I go into any one of these I see just another collection of I see a Sub-collection of folders and files. I see a sub collection of folders and files I don't have permission to go into there. So I'm not going to go into there You get my my drift I could fonts. I have permission to go into fonts collection as well so This starts to kind of expand One of the other things that we start to look at when we're dealing with our our roots is what we would classify as The height and the height it's told by How many levels we have? So this level right here where a happens to be sitting That's level zero nothing terribly crazy nothing terribly at Landish, but he knows how BC and D are sort of the direct what we call Let's say let me kind of put this here. We would call this a descendant descendant of a right so How far is it? Well, it's only one level below a same kind of thing F is Technically speaking a descendant of B a child of B F is also a descendant of a you can see if we follow this Line here, it's leading up to a So as you can imagine this section here is our two and this section is our three Now I've been using the term section for a little bit But one of the things that we can kind of take note with that is if I looked at any particular Kind of level. Let's say I do too This is what we would classify as our depth. How far down the tree does it go? And we continued can do it. Excuse me. We continue to expand on these ideas. So Like I was doing earlier. You saw that I happened to have be leading all the way to a so I Used a term there. I used let me actually kind of delete some of this stuff Boop There we are. I used a term Let's actually redraw that line. I called this a Path so a few different terms are actually kind of coming into play if I look at this B to F kind of connection here That is what we would classify as an edge Now that edge in this case It gets broken down that B is the parent of F as such a Path is a collection of edges. So as we can see I did a B and F connection I'll change colors here and I have another edge that would be a To be and so that's sort of the higher the start of that's the path of F to a