Example #1
0
        public void InsertSimpleRightRotation()
        {
            var t = Tree(3, 2);

            AssertTree(t, "3L=2|*");
            UnsafeOrderedCollection.Insert(t, 1);
            AssertTree(t, "2=1|3");
            UnsafeOrderedCollection.Free(t);
        }
Example #2
0
        public void InsertSimpleLeftRightRotation()
        {
            var t = Tree(2, 3);

            AssertTree(t, "2R=*|3");
            UnsafeOrderedCollection.Insert(t, 1);
            AssertTree(t, "2=1|3");
            UnsafeOrderedCollection.Free(t);
        }
Example #3
0
        public void InsertSimpleLeftRotation()
        {
            var t = Tree(1, 2);

            AssertTree(t, "1R=*|2");
            UnsafeOrderedCollection.Insert(t, 3);
            AssertTree(t, "2=1|3");
            UnsafeOrderedCollection.Free(t);
        }
Example #4
0
        public void DeleteSimpleLeftRightRotation()
        {
            var t = Tree(3, 4, 1, 2);

            AssertTree(t, "3L=[1R=*|2]|4");
            UnsafeOrderedCollection.Remove(t, 4);
            AssertTree(t, "2=1|3");
            UnsafeOrderedCollection.Free(t);
        }
Example #5
0
        public void DeleteSimpleRightRotation()
        {
            var t = Tree(3, 2, 4, 1);

            AssertTree(t, "3L=[2L=1|*]|4");
            UnsafeOrderedCollection.Remove(t, 4);
            AssertTree(t, "2=1|3");
            UnsafeOrderedCollection.Free(t);
        }
Example #6
0
        public void DeleteSimpleRightLeftRotation()
        {
            var t = Tree(2, 1, 4, 3);

            AssertTree(t, "2R=1|[4L=3|*]");
            UnsafeOrderedCollection.Remove(t, 1);
            AssertTree(t, "3=2|4");
            UnsafeOrderedCollection.Free(t);
        }
Example #7
0
        public void DeleteSimpleLeftRotation()
        {
            var t = Tree(2, 1, 3, 4);

            AssertTree(t, "2R=1|[3R=*|4]");
            UnsafeOrderedCollection.Remove(t, 1);
            AssertTree(t, "3=2|4");
            UnsafeOrderedCollection.Free(t);
        }