Can anyone tell me how to implement this in C++.
A segment tree which finds range min query and on each update makes all the elements in a range equal to x.
Basically for two type of queries, it does this ;
1 l r means to find the min number from l to r
2 l r x means to make all the numbers in the array equal to x within range l to r.
Thank you in advance.
You need a lazy Segment Tree. You can learn about it here: e-maxx-eng. The last example in this tutorial is "Adding on segments, querying for maximum". It should be very easy to modify it to your needs.