Pre-order

In pre-order traversal, the root node is visited first, followed by the left node and then the right node. The principles of pre-order traversal are as follows:

  1. Display the data part of the root (or current node).
  2. Traverse the left subtree by recursively calling the pre-order function.
  3. Traverse the right subtree by recursively calling the pre-order function.

The preceding tree will have F, B, A, D, C, E, G, I, and H as output as it is being traversed in pre-order.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset