Step 1: curr at 4, left child exists, find predecessor (rightmost in left subtree)
4 [curr] -> 2 -> 1 -> 3 -> null
Predecessor of 4 is 3
Why: We need to find where to return after finishing left subtree
Step 2: Make 3's right point to curr (4) to remember return path, move curr to left child (2)
4 ← 3 -> 4 [curr]
2 [curr] -> 1 -> 3 -> 4
Temporary link created
Why: Temporary link helps us come back to 4 after left subtree
Step 3: curr at 2, left child exists, find predecessor (1)
2 [curr] -> 1 -> null
Predecessor of 2 is 1
Why: Find return point after left subtree of 2
Step 4: Make 1's right point to curr (2), move curr to left child (1)
1 [curr] -> null
1 -> 2 [curr]
Temporary link created
Why: Remember to return to 2 after left subtree
Step 5: curr at 1, no left child, print 1, move curr to right (which points to 2)
1 printed
curr moves to 2 [curr]
Why: No left subtree, so print and move right
Step 6: curr at 2, predecessor's right points to curr, remove temporary link, print 2, move curr to right (3)
2 printed
Temporary link removed
curr moves to 3 [curr]
Why: Left subtree done, print node and move right
Step 7: curr at 3, no left child, print 3, move curr to right (which points to 4)
3 printed
curr moves to 4 [curr]
Why: No left subtree, print and move right
Step 8: curr at 4, predecessor's right points to curr, remove temporary link, print 4, move curr to right (5)
4 printed
Temporary link removed
curr moves to 5 [curr]
Why: Left subtree done, print node and move right
Step 9: curr at 5, no left child, print 5, move curr to right (null)
5 printed
curr moves to null (end)
Why: No left subtree, print and finish
Result: 1 -> 2 -> 3 -> 4 -> 5 -> null
Printed inorder traversal without stack or recursion