public static void NLargestElementInBinarySearchTree_HandlesTreeWithNotEnoughNodes()
        {
            var root = BinaryTreeStringUtil.Create("[2] [1 3]");

            Assert.That(NLargestElementInBinarySearchTree.FindInOrder(root, 4), Is.EqualTo(null));
            Assert.That(NLargestElementInBinarySearchTree.FindQueue(root, 4), Is.EqualTo(null));
        }
        public static void NLargestElementInBinarySearchTree_HandlesShallowTree2()
        {
            var root = BinaryTreeStringUtil.Create("[2] [1 3]");

            Assert.That(NLargestElementInBinarySearchTree.FindInOrder(root, 2).Value, Is.EqualTo(2));
            Assert.That(NLargestElementInBinarySearchTree.FindQueue(root, 2).Value, Is.EqualTo(2));
        }
        public static void NLargestElementInBinarySearchTree_HandlesDeepTree()
        {
            var root = BinaryTreeStringUtil.Create("[8] [4 12] [2 6 10 14] [1 3 5 7 9 11 13 15]");

            Assert.That(NLargestElementInBinarySearchTree.FindInOrder(root, 5).Value, Is.EqualTo(11));
            Assert.That(NLargestElementInBinarySearchTree.FindQueue(root, 5).Value, Is.EqualTo(11));
        }
        public static void NLargestElementInBinarySearchTree_HandlesLeftTree()
        {
            var root = BinaryTreeStringUtil.Create("[4] [2 *] [1 3 * *]");

            Assert.That(NLargestElementInBinarySearchTree.FindInOrder(root, 2).Value, Is.EqualTo(3));
            Assert.That(NLargestElementInBinarySearchTree.FindQueue(root, 2).Value, Is.EqualTo(3));
        }
        public static void NLargestElementInBinarySearchTree_HandlesNormal2()
        {
            var root = BinaryTreeStringUtil.Create("[4] [2 6] [1 3 5 7]");

            Assert.That(NLargestElementInBinarySearchTree.FindInOrder(root, 4).Value, Is.EqualTo(4));
            Assert.That(NLargestElementInBinarySearchTree.FindQueue(root, 4).Value, Is.EqualTo(4));
        }
 public static void NLargestElementInBinarySearchTree_HandlesNullRoot()
 {
     Assert.Throws <ArgumentNullException>(() => NLargestElementInBinarySearchTree.FindInOrder(null, 2));
     Assert.Throws <ArgumentNullException>(() => NLargestElementInBinarySearchTree.FindQueue(null, 2));
 }