Iterative In-order Traversal of Binary Tree
Write a method for the iterative in-order traversal of a binary tree.
We'll cover the following...
Statement
Given a binary tree, write an iterative algorithm for the in-order traversal of a binary tree. The algorithm should print out the value of each node such that it conforms to the in-order traversal of the input binary tree. The function is not expected to return a value, only to print it out on the console.
Example
Let’s look at the tree below:
The in-order traversal of the above tree produces the following output: 25, 35, 50, 75, 100, 200.
Sample input
The input list below represents the level-order traversal of the binary tree:
[100, 50, 200, 25, 75, 35]
Expected output
The sequence below represents the in-order traversal of the binary tree:
25, 35, 50, 75, 100, 200
Try it yourself
Note: The binary tree ...
Access this course and 1400+ top-rated courses and projects.