In preorder traversal using stack, if we push right node first and then push left node, while popping those nodes, left will come first and then right node, same as in the case of recursion. Can we do it in this way?
Actually, at most of the places on web, I found it the way I asked. If the method/sequence described by you is used, it is referred to as "Reverse Pre-order".
Your videos are really good for understanding tree traversals. Thanks a lot!
In preorder traversal using stack, if we push right node first and then push left node, while popping those nodes, left will come first and then right node, same as in the case of recursion. Can we do it in this way?
darshanaspathak 3 months ago
@darshanaspathak yes
Agilowen 3 months ago
@Agilowen : Thanks.
Actually, at most of the places on web, I found it the way I asked. If the method/sequence described by you is used, it is referred to as "Reverse Pre-order".
Your videos are really good for understanding tree traversals. Thanks a lot!
darshanaspathak 3 months ago
thanks, it helped alot for my exam
khanjkkhan 8 months ago 2