is it efficient enough to update range in segment tree by loop(range_start,range_end)update();
using the following code for update operation
void updateValueUtil(int *st, int ss, int se, int i, int diff, int index)
{
// Base Case: If the input index lies outside the range of this segment
if (i < ss || i > se)
return;
// If the input index is in range of this node, then update the value
// of the node and its children
st[index] = st[index] + diff;
if (se != ss)
{
int mid = getMid(ss, se);
updateValueUtil(st, ss, mid, i, diff, 2*index + 1);
updateValueUtil(st, mid+1, se, i, diff, 2*index + 2);
}
}
please give any efficient method…