Beispiel #1
0
 public static LazySegmentTree Create(List <int> values, ISegmentTreeOperation operation)
 {
     if (values == null)
     {
         throw new ArgumentNullException("values");
     }
     return(new LazySegmentTree(values, operation));
 }
Beispiel #2
0
 protected LazySegmentTree(List <int> values, ISegmentTreeOperation operation)
 {
     this.operation = operation;
     count          = values.Count;
     size           = Utils.NextPowerOfTwo(values.Count);
     tree           = new int[(size << 1) - 1];
     lazy           = new int[(size << 1) - 1];
     BuildTree(values, 0, 0, size - 1);
 }