示例#1
0
        public void TestKthSmallestElementInBST()
        {
            var root   = TreeNode.BuildBSTFromArray(new[] { 3, 1, 4, 2 });
            var result = KthSmallestElementInBST.Find(root, 1);

            Assert.AreEqual(result, 1);

            root   = TreeNode.BuildBSTFromArray(new[] { 5, 3, 6, 2, 4, 1 });
            result = KthSmallestElementInBST.Find(root, 3);
            Assert.AreEqual(result, 3);
        }
 public void Setup()
 {
     solution = new KthSmallestElementInBST();
 }