Inorder (morris Traversal)

easy
1. You are given a partially written BinaryTree class.
2. You are required to complete the body of morrisTraversalInorder function. The function is expected to print inorder of the BinaryTree such tht you neither allowed use of Recursive Method nor External Stack. All elements in an order must be separated by a space.
3. Input is managed for you.
4. NOTE: 
    ->Required Time Complexity : O(n)
    ->Required Space Complexity : O(1)

Input Format

Input is managed for you

Output Format

in order (elements separated by space)

Constraints

None

Example

Input
13
20 10 25 n n 39 n n 17 n 19 n n
Output
Inorder : 
25 10 39 20 17 19 
Previous
Linear Equation Of N Variables
Next
Iterative Postorder

Related Questions