This course has been updated into a 4 part series! We now recommend you take the A Practical Guide to Algorithms with JavaScript course.

Check out a free preview of the full Data Structures and Algorithms in JavaScript course:
The "Post-Order Traversal" Lesson is part of the full, Data Structures and Algorithms in JavaScript course featured in this preview video. Here's what you'd learn in this lesson:

## Post-order traversal will fully explore the left and right children of a node before return to examine the current node. After looking at the post-order pseudocode, Bianca summarizes Binary Search Tree traversal by comparing the in-order, pre-order, and post-order prototype implementations.

Get Unlimited Access Now

Transcript from the "Post-Order Traversal" Lesson

[00:00:00]
>> Bianca Gandolfo: So post-order, let's take a little peek here.
>> Bianca Gandolfo: So our 5, 3, 6. So if we're doing left, right, self, those terms, what is post-order?
>> Speaker 2: Left, right, self.
>> Bianca Gandolfo: Mm hm, left, right, self.
>> Speaker 2: But the terms are in the pattern.
>> Bianca Gandolfo: Mm hm.
>> Speaker 2: Then then in is in between.

[00:00:35]
>> Bianca Gandolfo: Yeah, in is actually in the correct order of smallest to highest. Yep, exactly, good catch there. I think I really do think that computer scientists coin terms to make things easier to remember, although sometimes it's easier to forget when they start making up crazy words for stuff like iteration.

[00:00:58] It's a loop. A lot of you would rather call it integration. Anyway, or K catination, I don't know.
>> Group: [INAUDIBLE] [LAUGH]
>> Bianca Gandolfo: Summation. Smoosh. Squish. Some fun ones. Or just name it something but a smaller version of you know, concat.
>> Bianca Gandolfo: Too little, call it.

[00:01:34] Okay, so we're kind of seeing a pattern here, right? So if we were gonna pseudocode this out, we would say left, right, self.
>> Bianca Gandolfo: So let us get rid of these.
>> Bianca Gandolfo: Okay,
>> Bianca Gandolfo: Left, right, self. So here's our solutions, it's not too far off from our pseudo code, right?

[00:02:18]
>> Speaker 5: No, it looks exactly the same.
>> Bianca Gandolfo: [CROSSTALK] Yeah, let's think that is the same. So in order, we do the child, then left, then right. For pre-order, we do self left then right. Post-order, left, right, and then self.
>> Bianca Gandolfo: It's quite elegant, right? This is why we say, recursion is elegant because doing a pretty complex traversal, we're doing a lot of things here is actually just a few lines of code.

[00:03:02] It's kind of nice. Do you feel your appreciation growing for recursion? Maybe day one recursion was like, my God, scary. Hopefully at this point you're like, wow, I can see that it's quite useful once you wrap your head around what's happening. So someone on chat was asking, what's this breath first business and we're gonna talk about that when we talk about graphs.

[00:03:30] But depth first, as the name suggests, goes all the way to the bottom. Depth, depth, depth and then pops back while breadth goes layer by layer. So if we have a tree which we do, we've been making trees all day. Where's our tree? Lot of arrows. So breadth would go this, then this one and this one and then this one, right?

[00:04:00] Well depth goes down first, but we'll get into specific implementation details on that tomorrow.