Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

This link really provided some insights into the idea that binary search implications into the optimization problems by giving the main theorem. I am not really confident that I get the idea of the main theorem suggested there. Are there any easy explanations, for the ideas, expressed in that tutorial?

share|improve this question
    
Can you give a better explanation which points are not clear to you? The tutorial is already a good one, it will be hard to give you a better explanation without knowing what's your problem. –  Doc Brown May 28 '13 at 7:36
    
Basically the main theorem's salient points were troubling me,like:"If the condition in the main theorem is satisfied, we can use binary search to find the smallest legal solution, i.e. the smallest x for which p(x) is true." –  user1369975 May 28 '13 at 8:02

1 Answer 1

The main requirement for binary search to work is that the array has to be sorted. Basically, the "main theorem" generalizes that requirement as needed for the generalized binary search on functions instead of arrays. From the article:

Behind the cryptic mathematics I am really stating that if you had a yes or no question (the predicate), getting a yes answer for some potential solution x means that you'd also get a yes answer for any element after x. Similarly, if you got a no answer, you'd get a no answer for any element before x. As a consequence, if you were to ask the question for each element in the search space (in order), you would get a series of no answers followed by a series of yes answers.

share|improve this answer
    
on monotonic functions, not on (arbitrary) functions –  Doc Brown May 28 '13 at 7:32
    
@Doc Brown: I think the requirement stated in the main theorem is fully sufficient. It's a further generalization from having a monotonic function and a greater-than predicate to just a predicate that fulfills this requirement. –  Michael Borgwardt May 28 '13 at 7:46
    
yes, you are right, I was a little bit too hasty with my comment. –  Doc Brown May 28 '13 at 9:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.