Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 20 Online
OpenStudy (anonymous):

So, I'm having some difficulty understanding bisection searching... When a computer is using brute force to find an answer to a problem it goes through each possible choice, correct? So bisection searching is completed when you write code to limit the search space? What does this code look like? I was confused by the instructors example.

OpenStudy (anonymous):

Here is a link to some code that using bisection searching (I hope it helps you): http://stackoverflow.com/questions/15075792/using-bisection-search-on-lowest-payments-on-credit-card-debt-and

OpenStudy (anonymous):

I believe bisection sort works because there is some transitive property about the data that will allow you to dismiss half of it with each iteration.

OpenStudy (anonymous):

For example, if the data is ordered, then the middle element can tell you whether it will be in the left half or the right half.

OpenStudy (anonymous):

So the code to make use of bisection search will limit the area the code by setting variables that outline the low and high limits of the search field? To make it even easier you can increment the variable by a larger value to make the brute force attack faster? Does that sound correct?

OpenStudy (rsmith6559):

Brute force and bisection are two different approaches to the problem of finding one element of a set of ordered elements. The telephone book (white pages) are a good demonstration: I want to find a buddy whose last name is Smith. I bisect the white pages to the middle and see that I'm at 'M'. I know that 'S' comes after 'M', so I can ignore the pages below where I am. I've cut the number of elements to search in half. I then bisect the upper pages and get 'T'. 'T' is after 'S', so I know the upper pages are useless. I continue on until I find my buddy. Bisection will find my target in less than log2n ( the number of elements log 2 ). A million elements can be searched with a maximum of 20 tries ( 2**20 ). Because the solution, ( finding the correct element ) can be found by repeatedly doing the same procedure, the problem is recursive. I hope they're teaching bisection and recursion separately.

OpenStudy (anonymous):

Wow, that's a good way to describe it! Thank you for the reply!

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!