(POGIL) Define a pseudocode algorithm that will efficiently play the guessing game.
Answer
function guessGame: {
const low = 0
const high = N
const middle = (low+high)/2
while (low < high or middle = target) {
if (middle < target) { high = middle - 1}
if (middle > target) {low = middle + 1}
middle = (low+high)/2
} if (middle = target) {
PRINT (“Found”) }
(POGIL) To guess a number between 1 and 100, what's the maximum number of guesses your algorithm would take?
Answer
4 guesses
(POGIL) To guess a number between 1 and 500, what's the maximum number of guesses your algorithm would take?
Answer
9 guesses to guess the number.
Suppose you have a deck of cards and you want to find the Ace of Spades. If the deck is shuffled, which is the best search algorithm to use and why?
Answer
A sequential would be the optimal search algorithm
Give an example of a search problem you encounter in everyday life. Do it use sequential, binary, or some other search?
Answer
A problem I have is that I use search bars when trying to access my google drive, but often times it doesn't find it.