Binary Tree, Data Structure Algorithm, Algorithms, Dotnet, Csharp.
output.Add(node.val); // Link the predecessor's right child to the current node predecessor.right = node; // Move to the left child node = node.left; } else { // If the predecessor's right child is not null, unlink it and move to the right child // Unlink the predecessor's right child