Question

Computer science question 1.I am thinking about my birthday. How many yes/no questions would you have...

Computer science question

1.I am thinking about my birthday. How many yes/no questions would you have to ask me to find out which month I was born in?

A. 12
B. 6
C. At least 3, but possibly 4.

D. At least 4

E. log2(2^12)

2.Now you have to guess everyoneʼs birth month. What is the average number of yes/no questions you will have to ask everyone?

A. 12
B. 6
C. ⌈ log2(12) ⌉

D. log2(12)

E. log2(2^12)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1.I am thinking about my birthday. How many yes/no questions would you have to ask me to find out which month I was born in?

Answer:

C. At least 3, but possibly 4.

Explanation:

we can use binary search here, whose time complexity is O(log(n)).
log2(12) = 3.584, which is in between 3 and 4
So, minimum I have to ask 3 questions and maximum 4.

2.Now you have to guess everyoneʼs birth month. What is the average number of yes/no questions you will have to ask everyone?

Answer:

D. log2(12)

Explanation:

Average is same as worst case ie log2(n) = log2(12)

Add a comment
Know the answer?
Add Answer to:
Computer science question 1.I am thinking about my birthday. How many yes/no questions would you have...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • how would i write my code in Pseudocode? I am pretty much a beginner, therefore this...

    how would i write my code in Pseudocode? I am pretty much a beginner, therefore this is my first major computer science assignment and im not really understanding the written way of code.. please help and explain. Thank you! this is my working code: # Guess The Number HW assignment import random guessesTaken = 0 names=[] tries=[] print("Welcome! ") question = input("Would you like to play the guessing game? [Y/N]") if question == "N": print("Sorry to see you go so...

  • I am taking a computer science course and my professor teaches much too fast. I am...

    I am taking a computer science course and my professor teaches much too fast. I am feeling so overwhelmed and lost. Very worried as well, as I am trying my very hardest in this class but just cant seem to grasp it. I have just been given this assignment.... Can someone explain what I am supposed to do? Is there one class? two? are there supposed to be multiple files? :( thanks! Write a Java class called a Circle that...

  • using python in eclipses Question I am attempting to solve My attempt... 1. Add a new...

    using python in eclipses Question I am attempting to solve My attempt... 1. Add a new module named twenty_questions_class to the package library. 2. Define a class named TwentyQuestions in the module with an instance constructor and a method. a. The instance constructor _init is used to create an instance of the TwentyQuestions class with a value for the RANGE. b. The method named play lets the user play the game. For example, I am thinking of a secret number...

  • Hello everyone! I need help on these few questions from my elementary calculus class, I am...

    Hello everyone! I need help on these few questions from my elementary calculus class, I am very confused, It is question 1a,b,c,d,e,f,g I need help on. Thank you so much :) - Anna 1. Find the derivative of the function. 5x7 - 773 + + 4x + 10 (a) f(x) = (b) f(x) = (x+3)(x2 + 2x - 4) (c) g(x) = (3x2 + 4x)" (d) y=2tV2 + 4 2002 - 2 (e) h(x) 1-23 (f) y = (3e' -...

  • I’m trying to check my answers to see if I have the correct answers. Can you...

    I’m trying to check my answers to see if I have the correct answers. Can you help me with the following questions? Thank you. 19. Yeah, I know he "won" the tournament, but I still don't think he is very good. "Won" is an example of a) a weaseler b) ridicule c) a down player d) syntactic ambiguity e) semantic ambiguity 20. Taking this course will possibly help you to pass the test. The word "possibly" is an example of...

  • I need help with my computer science 2 lab. First I am asked to run the...

    I need help with my computer science 2 lab. First I am asked to run the following program and check output? public static void main(String []args) { String filename= "output.txt"; File file = new File(fileName);    try{ FileWriter fileWriter = new FileWriter(file, true); fileWriter.write("CS2: we finished the lecuter\n"); fileWriter.close(); }catch (Exception e){ system.out.println("your message"+e); } String inputfileName = "output.text"; File fileToRead = new File (inputfileName); try { Scanner = new Scanner (fileToread); while(Scanner.hasNextLine()){ String line = scanner.nextLine(); system.out.println(line); } }catch(Eception...

  • Alabama A&M University Department of Electrical Engineering and Computer Science EE 201 Linear Cireuit Analysis I...

    Alabama A&M University Department of Electrical Engineering and Computer Science EE 201 Linear Cireuit Analysis I Fall 2018 Test # 6 roled Name For each problem circle the correct 1. Find li in the circuit below. (a) 7 mA (b) -2 mA (c) 4 mA (d) 3 mA (e) 5 mA (6) -6 mA 25mA Ii 2. Find I, in the circuit below (a) 15 mA (b) 8 mA (c)-3 mA (d) 12 mA (e) -9 mA ( 36 mA...

  • just answer this question.transwer to computer science deprtment how can i make an app for free...

    just answer this question.transwer to computer science deprtment how can i make an app for free answer this question!!! why do you multiply ? HOW do you approach this problem why is the answer 1/35 explain as of dec 1 till NOW jan 4 this is my monthly routine" i made this in a month is this good enough with my expenses being $20,000 in total... i want to see if i should dropout of college and continue this business...

  • i am a tourism student and this is my computer reservation course's quiz 1. Airlines use...

    i am a tourism student and this is my computer reservation course's quiz 1. Airlines use AI/ Data Science and machine learning to: or to 2. What are two of the main problems airlines must understand and solve to be able to survive? 3. List 7 factors that the airlines may consider when analyzing date to design their operation. 4. Which organization suggests that airlines may use traveler behavioral data to design their operation? 5. List the 3 types of...

  • I am a tourism student and this is my computer reservation course's quiz 1. Airlines use...

    I am a tourism student and this is my computer reservation course's quiz 1. Airlines use AI/ Data Science and machine learning to: _________ or to _____________ 2. What are two of the main problems airlines must understand and solve to be able to survive? 3. List 7 factors that the airlines may consider when analyzing date to design their operation. 4. Which organization suggests that airlines may use traveler behavioral data to design their operation? 5. List the 3...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT