Math, asked by peulathilakchagmail, 1 month ago

Obtain first ix iterations of the bisection method to find an approximation to 3



31.​

Answers

Answered by Anonymous
3

Answer:

Actually if they would have given 2 as option then as per me if i am applying Binary search then the answer should then have be 2.

I illustrate it below:

1,2,3,4,5,6,7,8,9

First Binary Search Algo:

Binary Search(a,x)

{

do{

mid=floor(beg+end/2);

if(a[mid]==x)

return TRUE

else if(x>a[mid])

lo=mid+1

else

hi=mid-1

}while(beg<=end)

}

Considering array indices startted at 1 and went to 9

lo=1

hi=9

mid=floor(1+9/2)=5 @ f(5) !=0 Fail

lo=1

hi=4 (its pritty intuitive why i chose lower half!)

mid=floor(1+4/2)=2 @ f(2)=0 <----tada!!! we have got it

Similar questions