This is a bit harder than iterative pre-order: now we have to check if there is a left or right element or not:
  • (START) push current
  • if there is left:
    • move left
  • else:
    • (ELSE) pop
    • visit
    • if there is right
      • move right
      • GOTO START
    • else:
      • GOTO ELSE
The control flow can be slightly simplified if we allow NULLs: www.geeksforgeeks.org/inorder-tree-traversal-without-recursion/

Articles by others on the same topic (0)

There are currently no matching articles.