
Player B: Okay, is your number (100 + 50) / 2 = 75 ? Player B: Sure and in 6 turns or less, is your number 100/2 = 50 ? Player A: I am thinking of a number from 1 to 100, can you guess my number within 6 turns ? Let's look at the guessing game example from before, but this time we will use the Divide and Conquer Algorithm to solve it

The Divide and Conquor Algorithm will show us that it would take at most 6 turns to guess the right answer, so although it's possible to guess the number anytime before the 6th turn, you are only guaranteed to be able to guess the correct number in 6 turns.Įxample 2 using Divide and Conquer Algorithm: Now suppose Player A asked if Player B could always guess the correct number in 4 turns, would they ? The answer is no.

Player A: Yes, congratulations you guessed my number in 4 turns you win!

Player A: I am thinking of a number from 1 to 100, can you guess my number within 4 turns ? The Divide and Conquer Algoritm will tell you if it is possible to guess player A's number in the given amount of turns x, and will tell the maximum amount of tries or guesses you will need in order to guess there number correctly. Player A will assist player B by telling player B if the number they guessed is higher than or lower than player A's randomly chosen number. To play the guessing, a person (player A) will choose a random numer from n to m, another person (player B) will have to guess player A's number in "x" turns.

Let's look at the guessing game as an example to use the Divide and Conquer Algorithm by halfing our possible number of guesses. The divide and conquor algorithm is a technique used to make a complicated problem easier to solve by splitting (or dividing) it into smaller more managable steps.
