public void Test2() { var root = new BinaryNode(7); root.Left = new BinaryNode(2); root.Right = new BinaryNode(3); root.Right.Left = new BinaryNode(8); root.Right.Right = new BinaryNode(5); var sut = new FindNthNodeOfInorderTraversal(); var result = sut.FindNthNode(root, 3); Assert.That(result, Is.EqualTo(8)); }
public void Test1() { var root = new BinaryNode(10); root.Left = new BinaryNode(20); root.Left.Left = new BinaryNode(40); root.Left.Right = new BinaryNode(50); root.Right = new BinaryNode(30); var sut = new FindNthNodeOfInorderTraversal(); var result = sut.FindNthNode(root, 4); Assert.That(result, Is.EqualTo(10)); }