BIT06 -Prefix Max Element Query

In this tutorial ,in the update method if we try and manipulate the any original value in the input array which is smaller than the current placed value in the input array we cat do that

since,
BIT[ i ] = max(BIT[ i ], val );
assume
original array to be
5,4,1,7,3

then the BIT array would be
5,5,1,7,3

what i want to update 4th index in input array,
it wont update the BIT array according to it ??

yes, you are right it won’t update bit array… video sol is will work only if we update array number with number greater than it.

1 Like