![Tree and Graph Data Structures](https://static.frontendmasters.com/assets/courses/2019-05-20-trees-and-graphs/thumb.webp)
Check out a free preview of the full Tree and Graph Data Structures course
The "Fill the Tree Activity" Lesson is part of the full, Tree and Graph Data Structures course featured in this preview video. Here's what you'd learn in this lesson:
Bianca leads an activity to take an empty binary search tree and fill in its node values, given an array of numerical node values.
Transcript from the "Fill the Tree Activity" Lesson
[00:00:00]
>> Bianca Gandolfo: Knowing what we know about binary search trees, take just two minutes. We don't need a break for this or anything. Just take two minutes to figure out which node goes where in this blank.
>> Bianca Gandolfo: Take two minutes to think about it and then we'll reconvene. All right, so, anyone know what this node is?
[00:00:29]
Five. Okay, how do we know that it's five?
>> Speaker 2: Started from the bottom left 1, 2, 3, 4, 5.
>> Bianca Gandolfo: That's how you did it. So you just started like, like the furthest left is going to be the minimum. Awesome. Anyone else figure that out in different way?
[00:00:50]
>> Bianca Gandolfo: No?
>> Speaker 3: Just on the mid point based on the weighted sides.
>> Bianca Gandolfo: Yeah, so you're like there's 4 less and there's 3 greater, so it has to be 5. Cuz here is 3 greater, here's 5, here's 4 less, yeah. That tends to be how I think about it.
[00:01:06]
Cool, so five here, and then here.
>> Speaker 3: 4.
>> Bianca Gandolfo: 4.
>> Speaker 2: 2.
>> Speaker 2: 1.
>> Speaker 2: 3.
>> Bianca Gandolfo: Great, I don't know why that one's not working.
>> Speaker 2: 7.
>> Speaker 2: 6.
>> Speaker 2: 8.
>> Bianca Gandolfo: Cool, awesome.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops