Reputation: 29
Suppose we are given a sequence of size n. We have to make this sequence strictly increasing.we can perform an operation any no of times. i.e select any two adjacent elements A(i) and A(i+1) and replace one of them with (A(i)+A(i+1))/2 (a real number, i.e. without rounding). You may also select each pair of adjacent elements and each element to replace in multiple operations, i.e. any number of times.
We have to tell if it is possible to make sequence strictly increasing? Two possibilities are if the size of the array is 2 and 1st element is greater than 2nd .then not possible. and another possibility is if it contains the same elements .then not possible. Is there any other possibility where answer is not possible.
Upvotes: 1
Views: 677
Reputation: 2604
Observation 1: If there are two neighboring numbers j, j and i > j, you can't get to the point where i < j without using any other number k. This is the reason why if you have only two numbers in decreasing order, it's not possible to get an increasing sequence.
Observation 2: If there are two numbers i, j and i < j, by repeating jk+1 = (i + jk) enough times, you can get j = i + c, where c is arbitrary small.
Alternatively, you can make the opposite(e.g. enlarging i so that is arbitrary close to j).
Consequence of 2nd Observation: If the first element is smaller than the last element, you can create your sequence:
Consequence of the previous step: As long as there are two numbers in an increasing order, the ordering is possible:
Consequence of Observation 1: If the numbers are in decreasing or weakly decreasing(non-increasing) order, they can't be reordered to the increasing order by the averaging operations.
Upvotes: 2