Esempio n. 1
0
        public void GetZigZag_EmptyTree_ReturnsEmptyList()
        {
            BalancedBinaryTree tree = new BalancedBinaryTree();

            List <BinaryTreeNode> nodes = tree.GetZigZag();

            Assert.IsTrue(nodes.Count == 0);
        }
Esempio n. 2
0
        public void GetZigZag_TreeWith6Nodes_Returns6NodesInZigZagOrder()
        {
            BalancedBinaryTree tree = new BalancedBinaryTree();

            tree.Root = new BinaryTreeNode(4);
            tree.Insert(tree.Root, 2);
            tree.Insert(tree.Root, 6);
            tree.Insert(tree.Root, 1);
            tree.Insert(tree.Root, 5);
            tree.Insert(tree.Root, 7);
            tree.Insert(tree.Root, 3);

            List <BinaryTreeNode> nodes = tree.GetZigZag();


            Assert.IsTrue(nodes.Count == 6);
        }