Binary Search


Problems

Problem : Why would happen if binary search were called on an unsorted array?


Problem : Does the middle pointer necessarily have to be given the value (first + last) / 2, or could it be any value in between first and last?


Problem : theSpark.com stores their user database in a big array, sorted alphabetically by user name. The array contains 2.5 million elements. How many comparisons, at most, will it take their binary search algorithm to locate the data it is searching for?


Problem : If you were to be doing many searches on a sorted linked list of n elements, how might you transform the list to increase the efficiency in the long run?


Problem : Someone gives you an array of integers sorted in descending order. Rewrite the binary search code to account for this.


Take a Study Break

SparkLife

What's your Pretty Little Liars name?

Take this quiz to find out!

SparkLife

Which young actress just got married?

Click to find out!

SparkLife

Cat bearding WINS THE INTERNET

Have you seen this yet?

SparkLife

Scary movies with funny posters

These. Are. Hilarious.

Geek out!

The MindHut

Geeky Actors: Then and Now

Travel back in time!

The MindHut

Villains We Want These Actresses to Play

From super cute to super bad!

The MindHut

10 Movies Better Than Their Books

What do you think?

The MindHut

Summer Movie Open Thread

Leave your thoughts here!

The MindHut

12 Scientific Inaccuracies in Into Darkness

What did Star Trek get wrong?

The Book

Cover image

Read What You Love, Anywhere You Like

Get Our FREE NOOK Reading Apps