Beispiel #1
0
        public void TestAddAVL(int[] input, int[] expectedOutput, int expectedHeight)
        {
            var tree = new AVLTree();

            for (int i = 0; i < input.Length; i++)
            {
                tree.AddAVL(input[i]);
            }

            var output = new LinkedList <int>();

            tree.LevelOrderTraversal(out output);
            Assert.Equal(expectedHeight, tree.Root.Height);
            for (int i = 0; i < expectedOutput.Length; i++)
            {
                Assert.Equal(expectedOutput[i], output.Get(i));
            }
        }