Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You are in a classroom with n students. Exactly one of the student have a pen, you don't know who. Your task is to determine
You are in a classroom with students. Exactly one of the student have a pen,
you don't know who. Your task is to determine which student have the pen.
You can questions to one student at at time and they can only answer yesno
A student who does not know where the pen is will always answer no
Now assume that the student who has the pen knows it Describe how to find
the pen asking questions.
Now assume all the students knows who has the pen. Describe how to find the
pen asking questions.
I wrote answers for this step by step but im not sure if its correct, because i dont know if i should write code or basic steps. I wrote that they were linear search and binary search algorithms
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started