Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 10: You are given a set P of n people, where n21. A person p P is called a very important person (VIP), if

image text in transcribed

Question 10: You are given a set P of n people, where n21. A person p P is called a very important person (VIP), if all other persons in P know p, but p does not know anybody in P (besides him/herself). Give a recursive algorithm that returns a VIP in P, if a VIP exist:s, nil, if there is no VIP in P. The running time of your algorithm must be O(n) You are only allowed to use the operation DoYoUKNow, which takes two arbitrary persons p and q in P, with p ^ q, and returns the value DoYockNow(p.q)= { true if p knows q, false if p does not know q. Observe that DoYouKNow(p, q) need not be equal to DoYouKnow(q, p)'. "DoYouKNOw(Michiel,Mick Jagger) = true, but DoYouKNOw(Mick Jagger,Michiel)-fase Argue why your algorithm is correct, and why its running time is O(n) Hint: If DoYouKNOW(p, q)- true, then p is not a VIP; if DoYoUKNow(p, q) -false, then q is not a VIP. Question 10: You are given a set P of n people, where n21. A person p P is called a very important person (VIP), if all other persons in P know p, but p does not know anybody in P (besides him/herself). Give a recursive algorithm that returns a VIP in P, if a VIP exist:s, nil, if there is no VIP in P. The running time of your algorithm must be O(n) You are only allowed to use the operation DoYoUKNow, which takes two arbitrary persons p and q in P, with p ^ q, and returns the value DoYockNow(p.q)= { true if p knows q, false if p does not know q. Observe that DoYouKNow(p, q) need not be equal to DoYouKnow(q, p)'. "DoYouKNOw(Michiel,Mick Jagger) = true, but DoYouKNOw(Mick Jagger,Michiel)-fase Argue why your algorithm is correct, and why its running time is O(n) Hint: If DoYouKNOW(p, q)- true, then p is not a VIP; if DoYoUKNow(p, q) -false, then q is not a VIP

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 Modeling And Design

Authors: Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, H.V. Jagadish

5th Edition

0123820200, 978-0123820204

More Books

Students also viewed these Databases questions

Question

Draw a schematic diagram of I.C. engines and name the parts.

Answered: 1 week ago

Question

b. Why were these values considered important?

Answered: 1 week ago