Example #1
0
        public void Test()
        {
            int[] array = new int[] { 7, 8, 3, 4, 2, };
            SegmentTree tree = new SegmentTree(array);
            tree.PlusSegment(0, 4, 1);
            tree.AssignSegment(0, 4, 0);
            tree.Assign(1, 3);
            tree.Plus(2, -1);

            Assert.AreEqual(2, tree.Sum(0, 4));
        }