Segment Tree Range Update

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…

What you are looking for is called Lazy propagation in a segment tree.

It is used to perform range updates.

Tutorial: http://se7so.blogspot.in/2012/12/segment-trees-and-lazy-propagation.html

Spoj practice problem: http://www.spoj.com/problems/HORRIBLE/

//