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.
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
Here is a link to some code that using bisection searching (I hope it helps you):
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.
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.
Not the answer you are looking for? Search for more explanations.
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?
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.
Wow, that's a good way to describe it! Thank you for the reply!