Question
How many additional people will have been exposed to a new disease after a given amount of days? The disease starts with a single infected
How many additional people will have been exposed to a new disease after a given amount of days? The disease starts with a single infected person. But each person has a resistance level and does not become infected until she has been in contact with multiple different infected persons. A person does not spread the disease until she is infected each of her contacts is exposed by her the day after she is infected.
Given npeople, ncontacts, and days (all integers) for each person, a name and the number of exposures until they become infected for each contact, which two people are in contact with each other. Return the number of people who have been exposed after days.
[pseudocode and bigO analysis]
Examples: (there is always one person with 0 resistance, the original source of the disease. Names consist of letters. 3 2 1 //3 people, 2 contacts Alice 0 Bob 1 Carol 1 Alice Bob Bob Carol After the given number of days (1) there is one person (Bob) who has been exposed. (Bob has also become infected.)
5 5 3 Alice 0 Bob 1 Carol 1 Dan 3 Erin 1 Alice Bob Alice Carol Bob Dan Carol Dan Dan Erin After 3 days a total of 3 people have been exposed to the disease.
Explanation: After the first day B and C have been exposed to the disease by contact with A, and both are infected (since their resistance levels are 1). On the second day D is exposed by both B and C but is not yet infected. On the third day no new exposures to uninfected persons occur, since D does not expose E since D is not infected. After 3 days, 2 people have been infected, and 3 people have been exposed to the disease.
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