コード例 #1
0
        public void CreateLevelLinkedList()
        {
            // create a new tree sructure
            TreeNode <int> root = new TreeNode <int>(3);

            TreesAndGraphs.Insert(root, 2);
            TreesAndGraphs.Insert(root, 1);
            TreesAndGraphs.Insert(root, 3);
            TreesAndGraphs.Insert(root, 5);
            TreesAndGraphs.Insert(root, 4);
            TreesAndGraphs.Insert(root, 6);
            List <LinkedList <TreeNode <int> > > list = new List <LinkedList <TreeNode <int> > >();

            TreesAndGraphs.CreateLevelLinkedList(root, list, 0);

            // View the content of the list to see the linkedlist structure
        }