0
votes

The total traversal combinations, possible for the below mentioned Sample Tree are

DLR, LDR, LRD, DRL, RDL, RLD

Sample Tree [ D=root , L= LeftNode , R= RightNode ]

  D
 / \
L   R

PreOrder: DLR

InOrder: LDR

PostOrder: LRD

Why other combinations like DRL, RDL & RLD never considered ?

1
I think that is just the way it's defined depending upon the usability use cases.nice_dev

1 Answers

0
votes

In a binary tree, the first child is on the left and the second child is on the right. In the combinations, DRL, RDL, and RLD, R comes before L which is against the concept of Tree and therefore they are never considered for the traversal of a binary tree.

Check this to learn more about the Tree data structure.