Hi friends,please help me solve this if you have some spare time :)↵
↵
a[1]-2*x[1]+x[n]=m;↵
↵
a[2]-2*x[2]+x[1]=m;↵
↵
a[3]-2*x[3]+x[2]=m;↵
↵
.↵
.↵
.↵
↵
a[n]-2*x[n]+x[n-1]=m;↵
↵
here the array a is given and the constant m is also given,we have to find out the values of all the xi's↵
in my approach i applied binary search on the value of x[n]..so lets suppose the assumed value of x[n]=mid↵
then after solving the equation if i will get the value of x[n]>mid then i will reduce the mid,else increase the mid till↵
the value of x[n] found out==mid...the problem here is that i have to find out an integral solution of the equations(if it exists)..so while solving the equations if some x[i] comes out to be a fractional value then we cannot proceed further with that value of mid..so if this happens then the current mid isnt a solution..now what should be the next mid value?increase/decrease or adjust it differently to converge to an integer solution(if it exists)?↵
↵
last question:is there some other way in which this problem can be solved?↵
↵
↵
a[1]-2*x[1]+x[n]=m;↵
↵
a[2]-2*x[2]+x[1]=m;↵
↵
a[3]-2*x[3]+x[2]=m;↵
↵
.↵
.↵
.↵
↵
a[n]-2*x[n]+x[n-1]=m;↵
↵
here the array a is given and the constant m is also given,we have to find out the values of all the xi's↵
in my approach i applied binary search on the value of x[n]..so lets suppose the assumed value of x[n]=mid↵
then after solving the equation if i will get the value of x[n]>mid then i will reduce the mid,else increase the mid till↵
the value of x[n] found out==mid...the problem here is that i have to find out an integral solution of the equations(if it exists)..so while solving the equations if some x[i] comes out to be a fractional value then we cannot proceed further with that value of mid..so if this happens then the current mid isnt a solution..now what should be the next mid value?increase/decrease or adjust it differently to converge to an integer solution(if it exists)?↵
↵
last question:is there some other way in which this problem can be solved?↵
↵