## mattyfar one year ago Can someone explain to me 'bisection search' ?

• This Question is Open
1. osanseviero

Ok, let's think we have to find a value in the range 1 to 1 million

2. osanseviero

I am going to try that you answer yourself

3. osanseviero

So...how would you try to find this value?

4. osanseviero

toc toc?

5. mattyfar

i know its where you guess half way and then see if the answer is lower or higher. I'm just now super clear on how to set it up in python

6. mattyfar

not*

7. osanseviero

You should write a psudo code first x is the value you are searching a is the max range b is the min range c is (a+b)/2 -> midpoint if x>c: the min range will be c now. else: the max range will be c now Something like that :) try working around it

8. seandisanti

Don't forget an epsilon value, or you may end up in an infinite loop.

9. UnkleRhaukus

sounds like binary search

10. ricketybridge

Are you referring specifically to Newton's method? Because that actually has a rather complicated proof to explain why it converges on the square root. For just how to implement it in Python, review the code from Prof. Guttag's examples: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00sc-introduction-to-computer-science-and-programming-spring-2011/unit-1/lecture-3-problem-solving/MIT6_00SCS11_lec03.pdf

11. lopus