using System.Collections.Generic;
public static void Main()
public static int lastPrinted = int.MinValue;
public static bool InOrderTraversal(Node root)
if (!InOrderTraversal(root.Left))
if (root.Data <= lastPrinted)
if (!InOrderTraversal(root.Right))
public static bool MinMax(Node root, int min = int.MinValue, int max = int.MaxValue)
MinMax(root.Left, min, root.Data) &&
MinMax(root.Left.Right, root.Data, max);
public Node Left { get; set; }
public Node Right { get; set; }
public int Data { get; set; }