Answered step by step
Verified Expert Solution
Link Copied!

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 n 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 yes/no.
A student who does not know where the pen is will always answer no.
5.2
Now assume that the student who has the pen knows it. Describe how to find
the pen asking O(n) questions.
5.3
Now assume all the students knows who has the pen. Describe how to find the
pen asking O(logn) 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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security XI Status And Prospects

Authors: T.Y. Lin, Shelly Qian

1st Edition

0412820900, 978-0412820908

More Books

Students also viewed these Databases questions

Question

LO14.2 Discuss how game theory relates to oligopoly.

Answered: 1 week ago