Exemplo n.º 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);
                }
            }
        }
Exemplo n.º 2
0
        private void SegmentTreeRangeUpdate()
        {
            var segmentTree = new LazySumSegmentTree(_array);

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

                segmentTree.Update(range.Item1, range.Item2, 1);
            }
        }