How it works...

Postorder traversal requires the L, R, and V tasks to be applied to each node of the binary tree. Here, L means visiting the left child, R means visiting the right child, and V means visiting the node that is displaying its content.

The question is, how will we know which tasks have already been performed on a node and which tasks are left to be performed? To do so, we will use two arrays, nodeArray and valueArray. nodeArray contains the node that the tasks are to be performed one, while valueArray is used to indicate what task has been left on the corresponding node. valueArray can have one of the following two values:

  • Value 0: This indicates that the left link of the node has been traversed and that two tasks are pending: ...

Get Practical C Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.