Morris Traversal for tree traversal. Time complexity O(n), Space complexity O(1)
Data structure definition.
|
|
Preorder
|
|
Inorder (The difference between Inorder and Preorder is only one line)
|
|
Postorder (The visiting order is a mirror reflection of Preorder, and the results should be reversed)
|
|