0
votes

Are there any specific applications of preorder and postorder traversals of a Binary Tree ?

PS: Application of Inorder Traversal : It is used to print the sorted numbers from a BST.

2

2 Answers

0
votes

How about tree serialization? E.g. heaps are usually stored in preorder, and that would be the canonical serialization order for fixed element sizes.

If you have dynamic element sizes, you can't write out child pointers in preorder, so postorder traversal is more appropriate. Some modern B+-tree disk layouts also use post-order IIRC, but it's not a strict postorder layout, as it needs to take dynamic changes into account.

0
votes

Preorder, Inorder and Postorder traversal of a Binary expression tree would give prefix, infix and postfix expressions respectively.