Purchase Solution

binary search

Not what you're looking for?

Ask Custom Question

What is a binary search, and how does it work?

Purchase this Solution

Solution Summary

This job defines a binary search.

Solution Preview

Binary Search is arguably one of the most useful algorithms you will come across. It accepts a sorted list of numbers, a single integer value x as input, and returns the xth greatest number in the list.

For example, consider the following sorted list of ten integers:
1, 2, 3, 4, 6, 8, 9, 10, 12, 15

Say that we are looking to see if 12 is in the list. First, look at the middle value in the list. We can find this by looking at the indices of the first and last elements. Since we have a list of ten numbers, we look for the element in position (1+10)/2 = 5.5. In our list, this is the number 6. We ...

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Javscript Basics

Quiz on basics of javascript programming language.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

C++ Operators

This quiz tests a student's knowledge about C++ operators.