Binary Tree, Data Structure Algorithm, Algorithms, Dotnet, Csharp.
the current node has no left child if (curr.left == null) { // Add the value of the current node to the result list result.Add(curr.val); // Move to the next right node curr = curr.right; } else { // If the current node has a left subtree // Find the rightmost node in the left subtree (predecessor