Ejemplo n.º 1
0
        private void TestIterator <T>(SCBinarySearchTree <T> tree) where T : IBinarySearchTreeElement
        {
            WriteBegin("Iterator:");
            var it = tree.Iterator();

            while (it.HasNext)
            {
                T data = it.Next;
                Write("     " + data.SortScore);
            }
            WriteLine("");
            WriteEnd("Iterator:");
        }
Ejemplo n.º 2
0
        public override void StartTest()
        {
            WriteBegin("BinarySearchTree");
            SCBinarySearchTree <IntWrap> tree = new SCBinarySearchTree <IntWrap>();

            IntWrap[] data = BuildIntWrapArray(new int[] { 0, 1, 2, 3, 4, 5 });//BuildIntWrapArray(new int[] { 10, 5, 8, 4, 18, 12, 20, 21 });
            tree.Insert(data);
            VisitTree(tree);
            TestRemove(tree, data[5]);
            TestRemove(tree, data[4]);
            TestRemove(tree, data[3]);
            TestRemove(tree, data[2]);
            IntWrap[] data2 = BuildIntWrapArray(new int[] { 6, 12, 234, 20, 77, 888, 76 });
            tree.Insert(data2);
            TestIterator(tree);
            WriteEnd("BinarySearchTree");
        }
Ejemplo n.º 3
0
 private void VisitTree <T>(SCBinarySearchTree <T> tree) where T : IBinarySearchTreeElement
 {
     WriteLine("Visitor:");
     tree.Accept(VisitorData);
     WriteLine("");
 }
Ejemplo n.º 4
0
 protected void TestRemove <T>(SCBinarySearchTree <T> tree, T data) where T : IBinarySearchTreeElement
 {
     WriteLine(" RemoveTest:");
     tree.Remove(data);
 }