Sometimes it’s confusing that what manner we have to follow for PRI-Oder, IN-Order, POSTER-Order Traversal.
So now you can see how to do In-order, Pri-order and Post-order traversal in different manner.
you will find shortcut technique for in-order, pri-order and post-order traversal.
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Tree Traversals (In-order, Pre-order and Post-order)
1.
2. How to Find PRI-ORDER, IN-ORDER, POST-ORDER
Traversal in TREE.
• As we all know there are certain rules (or manner) that we have to follow for Traversal
in tree.
• Pri-Order :- Root, Left, Right.
• In-Order :-Left, Root, Right.
• Post-Order :-Left, Right, Root .
• Sometimes it’s confusing that what manner we have to follow for PRI-Oder, IN-Order,
POSTER-Order Traversal.
• So now we see how to do In-order, Pri-order and Post-order traversal in different
manner.
3.
4. Left, Right, Bottom side of NODE.
50Left-hand side of Node Right-hand side of Node
Bottom side of Node
5.
6. For PRI-ORDER TRAVERSAL.
IF YOU ARE IN LEFT-HAND SIDE OF NODE THEN YOU
HAVE TO WRITE THAT VALUE IN OUTPUT.
50
Pri-Order:-
50
7. • IF YOU ARE IN BOTTOM OF THE NODE THEN YOU DON’T
HAVE TO WRITE ANYTHING IN OUTPUT.
50
Pri-Order:- NULL
PRI-ORDER TRAVERSAL
8. • IF YOU ARE IN RIGHT-HAND SIDE OF THE NODE THEN
ALSO YOU DON’T HAVE TO WRITE ANTHING IN OUTPUT.
50
Pri-Order:- NULL
PRI-ORDER TRAVERSAL
9. Now see how to follow this steps in TREE Traversal.
19. 50
35
20 45 9060
80
Let’s see one example.
IF YOU ARE IN BOTTOM
SIDE OF NODE THEN YOU
HAVE TO WRITE THAT
VALUE IN OUTPUT
20
IN-ORDER:- .
35
45
50
60
80
90
20.
21. For POST-ORDER TRAVERSAL.
IF YOU ARE IN LEFT-HAND SIDE OF NODE THEN YOU
DON’T HAVE TO WRITE THAT VALUE IN OUTPUT.
50
POST-Order:-NULL
50
22. • IF YOU ARE IN BOTTOM OF THE NODE THEN YOU DON’T
HAVE TO WRITE ANYTING IN OUTPUT.
50
POST-Order:-NULL
POST-ORDER TRAVERSAL
23. • IF YOU ARE IN RIGHT-HAND SIDE OF THE NODE THEN
YOU HAVE TO WRITE THAT VALUE IN OUTPUT.
50
POST-Order:-
50
POST-ORDER TRAVERSAL
26. 50
35
20 45 9060
80
Let’s see one example.
Post-Order:- .
20
IF YOU ARE IN RIGHT-
HAND SIDE OF NODE
THEN YOU HAVE TO
WRITE THAT VALUE
IN OUTPUT
45
35
60 90
80
50
27. Conclusion
• PRI-ORDER :- Consider the value If you are in LEFT-HAND SIDE
of the NODE.
• IN-ORDER :- Consider the value if you are in BOTTOM SIDE
of the NODE
• POST-ORDER:- Consider the value If you are in RIGHT-HAND SIDE
of the NODE.
50
50
50
28. • Still if you have any queries then ask them on.
Email:-Upadhyayraj007@gmail.com