示例#1
0
        private void ListOfDepthsTest()
        {
            TreeBinaryNode <int> tree = CreateBinarySearchTree <TreeBinaryNode <int> >(11);
            List <LinkedList <TreeBinaryNode <int> > > l  = Q4_3ListOfDepths.getListOfDepths <int>(tree);
            List <LinkedList <TreeBinaryNode <int> > > l2 = Q4_3ListOfDepthsIterative.getListOfDepths <int>(tree);

            int[][] result =
            {
                new int[1] {
                    5
                },
                new int[2] {
                    2, 8
                },
                new int[4] {
                    0, 3, 6, 9
                },
                new int[4] {
                    1, 4, 7, 10
                }
            };

            checkValues(l, result);
            checkValues(l2, result);
        }
示例#2
0
        private void ListOfDepthsNullTest()
        {
            List <LinkedList <TreeBinaryNode <int> > > list = Q4_3ListOfDepths.getListOfDepths <int>(null);

            Assert.True(list.Count.Equals(0));
            List <LinkedList <TreeBinaryNode <int> > > list2 = Q4_3ListOfDepthsIterative.getListOfDepths <int>(null);

            Assert.True(list2.Count.Equals(0));
        }