 What's up guys? My name is Michael and welcome to my YouTube channel. Today we're going to go over trees now. The first one is going to be tree pre-order traversal. So pre-order traversal is not that difficult. Basically you're going to look at your current node and then you're going to look at pointers to the root of the tree and must print the values in pre-order traversal. So pre-order is, I think it's node then left then right. So yeah, you do print the current node at then you print our left and right nodes. So in this case we print the first node and left node is null so we don't print anything. We print 2 and once 2 is printed we're going to print the left node which is nothing and the right node which is 5. Once 5 is printed we're going to print the left node which is 3 and then we print 6 which is the right node and then yeah, that's it. And then once 3 is printed we're going to print 4, yeah, oh yeah, node left, yeah. So we print 3 and 4 and then right which is 6. So we print the first node then it's left child then we print the right node. It's right child. So yeah, to do this it's not that hard we're just going to do first print out the root node so it's root data node and we recursively what what the hell is wrong with this. So we got node which is our current node that we're at and we print we recursively call on the left. So it's going to be left and we do pre-order on the right. Okay. And then after that we submit and it's not working because I say fault why I say fault why I say fault left right node and go left and go right way. Why did I did I say fault print out the node because we're called left because we're called on the right. I got to pass this. No, no, I can't do that. Oh, okay. So we got to check if the roots left is null. Actually we could just check if root is null. Root is not null. Then we print out the data. All right. Recursively call on the left. Recursively call on the right. We still failed for some reason. Fragmentation fault. Poor dumb. Oh yeah, we got to check if root left is not equal to no pointer. We do this because you're called left and check if roots rise on equal to no pointer. And then we take this move this here. So yeah, essentially we're just printing the current node and then we print up the left child and then the right child. And it's still not running for some reason. One, two, three, four, five, six. Oh, I got to print out a space. I'm forgetting spaces. I'm so used to printing like new lines. Okay. Yeah. And then it works. That's all the gist of the pre-order traversal. Print out your current node and print out its left child and then print out its right child. That's it. I hope you guys enjoyed this video. Write a comment, subscribe. I'll check you guys later. Peace.