예제 #1
0
        private void SegmentTreeRandomOperation()
        {
            var segmentTree = new LazySumSegmentTree(_array);

            for (int i = 0; i < _randomRangesCount; ++i)
            {
                Tuple<int, int> range = _randomRanges[i];

                if (range.Item1 % 2 == 0)
                {
                    segmentTree.SumQuery(range.Item1, range.Item2);
                }
                else
                {
                    segmentTree.Update(range.Item1, range.Item2, 1);
                }
            }
        }
예제 #2
0
        private void SegmentTreeSumQuery()
        {
            var segmentTree = new LazySumSegmentTree(_array);

            for (int i = 0; i < _randomRangesCount; ++i)
            {
                Tuple<int, int> range = _randomRanges[i];

                segmentTree.SumQuery(range.Item1, range.Item2);
            }
        }