Wolves and sheep The 2019 Stack Overflow Developer Survey Results Are In ...

Was credit for the black hole image misattributed?

Are my PIs rude or am I just being too sensitive?

Would an alien lifeform be able to achieve space travel if lacking in vision?

Take groceries in checked luggage

Sort a list of pairs representing an acyclic, partial automorphism

Road tyres vs "Street" tyres for charity ride on MTB Tandem

Searching for a differential characteristic (differential cryptanalysis)

What are these Gizmos at Izaña Atmospheric Research Center in Spain?

High Q peak in frequency response means what in time domain?

Did God make two great lights or did He make the great light two?

What can I do if neighbor is blocking my solar panels intentionally?

How can I protect witches in combat who wear limited clothing?

How to stretch delimiters to envolve matrices inside of a kbordermatrix?

Difference between "generating set" and free product?

Can a novice safely splice in wire to lengthen 5V charging cable?

How should I replace vector<uint8_t>::const_iterator in an API?

Is this wall load bearing? Blueprints and photos attached

First use of “packing” as in carrying a gun

Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?

Can a 1st-level character have an ability score above 18?

Working through the single responsibility principle (SRP) in Python when calls are expensive

What is special about square numbers here?

does high air pressure throw off wheel balance?

Am I ethically obligated to go into work on an off day if the reason is sudden?



Wolves and sheep



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Fastest way to collect an arbitrary armyMiddle weight puzzleA puzzle of trust and lies, allies and spiesCooperative guessing against an evil godLabeling wires in a *damaged* bundleMonopoly Game Show: Is there a winning strategy?Picking A Number GamePrisoners and minority votingMove 10 sheep on another shoreBlindfold Bingo












5












$begingroup$


All the sheep were living peacefully in the Land of Shewo. But suddenly they were struck by a danger. A few wolves dressed up as sheep entered the territory of Shewo and started killing the sheep one by one.



To find a solution to this misery, the king of Shewo called upon all of his sheep to the palace hall. He made the following announcement:




From my secret sources, I came to know that the total number of 'sheep' (including the wolves) now present in my kingdom is 100. Among which 5 are wolves. Our doctors have come up with a very expensive blood test which could be used to differentiate the wolves and sheep.



Each test costs 1000$ and we don't have enough funds to test all the 100 'sheep'.



I discussed with our ministers and came to know that the tests can be done on pooled bloodsamples. i.e., I can collect bloods from any number of 'sheep' and mix them. Then if I test the mixture, I will get a positive result if the mixture contain blood from any wolf. I will get a negative result if all the samples are from actual sheep.




One caveat is that the test results are available to you after all the tests are done!




Now , I am looking for ideas where I can find ALL the wolves in minimum number of pooled tests. I request the brilliant young minds of this land to come up with a testing strategy.




Can you help the king by devising a strategy?










share|improve this question









$endgroup$












  • $begingroup$
    This is close to a covering design (Lotto wheel) problem.
    $endgroup$
    – Arnaud Mortier
    3 hours ago






  • 1




    $begingroup$
    First of all, does the government have enough funds to test 99 of the sheep? Because that would work, at a cost of $99,000. Congrats, you just saved 1,000 bucks.
    $endgroup$
    – user45266
    1 hour ago








  • 1




    $begingroup$
    Alternatively, you know the location of all 5 wolves. Take initiative and slaughter all 100. Now you have no more wolves, and food for a good while to come.
    $endgroup$
    – user45266
    1 hour ago
















5












$begingroup$


All the sheep were living peacefully in the Land of Shewo. But suddenly they were struck by a danger. A few wolves dressed up as sheep entered the territory of Shewo and started killing the sheep one by one.



To find a solution to this misery, the king of Shewo called upon all of his sheep to the palace hall. He made the following announcement:




From my secret sources, I came to know that the total number of 'sheep' (including the wolves) now present in my kingdom is 100. Among which 5 are wolves. Our doctors have come up with a very expensive blood test which could be used to differentiate the wolves and sheep.



Each test costs 1000$ and we don't have enough funds to test all the 100 'sheep'.



I discussed with our ministers and came to know that the tests can be done on pooled bloodsamples. i.e., I can collect bloods from any number of 'sheep' and mix them. Then if I test the mixture, I will get a positive result if the mixture contain blood from any wolf. I will get a negative result if all the samples are from actual sheep.




One caveat is that the test results are available to you after all the tests are done!




Now , I am looking for ideas where I can find ALL the wolves in minimum number of pooled tests. I request the brilliant young minds of this land to come up with a testing strategy.




Can you help the king by devising a strategy?










share|improve this question









$endgroup$












  • $begingroup$
    This is close to a covering design (Lotto wheel) problem.
    $endgroup$
    – Arnaud Mortier
    3 hours ago






  • 1




    $begingroup$
    First of all, does the government have enough funds to test 99 of the sheep? Because that would work, at a cost of $99,000. Congrats, you just saved 1,000 bucks.
    $endgroup$
    – user45266
    1 hour ago








  • 1




    $begingroup$
    Alternatively, you know the location of all 5 wolves. Take initiative and slaughter all 100. Now you have no more wolves, and food for a good while to come.
    $endgroup$
    – user45266
    1 hour ago














5












5








5





$begingroup$


All the sheep were living peacefully in the Land of Shewo. But suddenly they were struck by a danger. A few wolves dressed up as sheep entered the territory of Shewo and started killing the sheep one by one.



To find a solution to this misery, the king of Shewo called upon all of his sheep to the palace hall. He made the following announcement:




From my secret sources, I came to know that the total number of 'sheep' (including the wolves) now present in my kingdom is 100. Among which 5 are wolves. Our doctors have come up with a very expensive blood test which could be used to differentiate the wolves and sheep.



Each test costs 1000$ and we don't have enough funds to test all the 100 'sheep'.



I discussed with our ministers and came to know that the tests can be done on pooled bloodsamples. i.e., I can collect bloods from any number of 'sheep' and mix them. Then if I test the mixture, I will get a positive result if the mixture contain blood from any wolf. I will get a negative result if all the samples are from actual sheep.




One caveat is that the test results are available to you after all the tests are done!




Now , I am looking for ideas where I can find ALL the wolves in minimum number of pooled tests. I request the brilliant young minds of this land to come up with a testing strategy.




Can you help the king by devising a strategy?










share|improve this question









$endgroup$




All the sheep were living peacefully in the Land of Shewo. But suddenly they were struck by a danger. A few wolves dressed up as sheep entered the territory of Shewo and started killing the sheep one by one.



To find a solution to this misery, the king of Shewo called upon all of his sheep to the palace hall. He made the following announcement:




From my secret sources, I came to know that the total number of 'sheep' (including the wolves) now present in my kingdom is 100. Among which 5 are wolves. Our doctors have come up with a very expensive blood test which could be used to differentiate the wolves and sheep.



Each test costs 1000$ and we don't have enough funds to test all the 100 'sheep'.



I discussed with our ministers and came to know that the tests can be done on pooled bloodsamples. i.e., I can collect bloods from any number of 'sheep' and mix them. Then if I test the mixture, I will get a positive result if the mixture contain blood from any wolf. I will get a negative result if all the samples are from actual sheep.




One caveat is that the test results are available to you after all the tests are done!




Now , I am looking for ideas where I can find ALL the wolves in minimum number of pooled tests. I request the brilliant young minds of this land to come up with a testing strategy.




Can you help the king by devising a strategy?







strategy combinatorics algorithm






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 4 hours ago









Jyotish RobinJyotish Robin

515112




515112












  • $begingroup$
    This is close to a covering design (Lotto wheel) problem.
    $endgroup$
    – Arnaud Mortier
    3 hours ago






  • 1




    $begingroup$
    First of all, does the government have enough funds to test 99 of the sheep? Because that would work, at a cost of $99,000. Congrats, you just saved 1,000 bucks.
    $endgroup$
    – user45266
    1 hour ago








  • 1




    $begingroup$
    Alternatively, you know the location of all 5 wolves. Take initiative and slaughter all 100. Now you have no more wolves, and food for a good while to come.
    $endgroup$
    – user45266
    1 hour ago


















  • $begingroup$
    This is close to a covering design (Lotto wheel) problem.
    $endgroup$
    – Arnaud Mortier
    3 hours ago






  • 1




    $begingroup$
    First of all, does the government have enough funds to test 99 of the sheep? Because that would work, at a cost of $99,000. Congrats, you just saved 1,000 bucks.
    $endgroup$
    – user45266
    1 hour ago








  • 1




    $begingroup$
    Alternatively, you know the location of all 5 wolves. Take initiative and slaughter all 100. Now you have no more wolves, and food for a good while to come.
    $endgroup$
    – user45266
    1 hour ago
















$begingroup$
This is close to a covering design (Lotto wheel) problem.
$endgroup$
– Arnaud Mortier
3 hours ago




$begingroup$
This is close to a covering design (Lotto wheel) problem.
$endgroup$
– Arnaud Mortier
3 hours ago




1




1




$begingroup$
First of all, does the government have enough funds to test 99 of the sheep? Because that would work, at a cost of $99,000. Congrats, you just saved 1,000 bucks.
$endgroup$
– user45266
1 hour ago






$begingroup$
First of all, does the government have enough funds to test 99 of the sheep? Because that would work, at a cost of $99,000. Congrats, you just saved 1,000 bucks.
$endgroup$
– user45266
1 hour ago






1




1




$begingroup$
Alternatively, you know the location of all 5 wolves. Take initiative and slaughter all 100. Now you have no more wolves, and food for a good while to come.
$endgroup$
– user45266
1 hour ago




$begingroup$
Alternatively, you know the location of all 5 wolves. Take initiative and slaughter all 100. Now you have no more wolves, and food for a good while to come.
$endgroup$
– user45266
1 hour ago










2 Answers
2






active

oldest

votes


















1












$begingroup$

Here's my shot at it:




Pool 50 of the sheep. Of those 50, if the result comes back positive (wolf detected), split in half again, testing 25 pooled together. If this comes back positive, either 12 or 13 ofthe positive group. You see where this is going. Any negative results rule out all sheep in that group. Worst case scenario, it takes 54 tests (see image for explanation). Best case scenario, you get 14 tests. Price range: 14,000 - 54,000 dollars.




Not sure yet of the expected average, but I know this is better than 99 tests on average.



Diagram:




sheep.jpg




If this isn't the optimal solution, then my best bet on how to improve it would be to:




split into 1/5 the size of each group.







share|improve this answer









$endgroup$













  • $begingroup$
    I do not consider it much of a spoiler (there must be better algorithms) but the worst case scenario can be easily reduced to 35 tests. rot13(Qb ovanel frnepurf sbe bar jbys. Rnpu frnepu vf qbar ba nyy gur furrc zvahf jbysf sbhaq va gur cerivbhf frnepurf. Lbh jvyy arrq 5 frnepurf. Rnpu frnepu jvyy gnxr ng zbfg 7 grfgf. Fb gur jbefg pnfr fpranevb vf 35 grfgf).
    $endgroup$
    – ppgdev
    1 hour ago










  • $begingroup$
    Wait a minute, how would that work? Could you be a little more specific?
    $endgroup$
    – user45266
    1 hour ago










  • $begingroup$
    @ppgdev Like starting with 100, you split the group into 5 groups? What do you mean?
    $endgroup$
    – user45266
    59 mins ago










  • $begingroup$
    I moved my comment into an upper bound answer, with a more detailed explanation.
    $endgroup$
    – ppgdev
    42 mins ago



















0












$begingroup$

There must be better algorithms, but just to put an upper bound on a solution, the worst case scenario can be reduced to




35 tests. Do binary searches for one wolf. Each search is done on all the sheep minus wolfs found in the previous searches. So the first binary search is done on a set of all 100 'sheep'. You will find a wolf in no more than 7 tests. The next binary search is done on remaining 99 sheep. And so on. You will need 5 binary searches. Each search will take at most 7 tests. So the worst case scenario is 35 tests.







share|improve this answer









$endgroup$













  • $begingroup$
    Unfortunately that will not actually work. The problem states you will only get the results of the tests after all the tests have been done (maybe it takes a few days for the results to come through!), so you can’t base your second test on the results of the first one.
    $endgroup$
    – Amorydai
    14 mins ago










  • $begingroup$
    @Amorydai, you are right. I missed what was stated in bold font :-). Removing my answer and comments.
    $endgroup$
    – ppgdev
    6 mins ago












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "559"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fpuzzling.stackexchange.com%2fquestions%2f81737%2fwolves-and-sheep%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1












$begingroup$

Here's my shot at it:




Pool 50 of the sheep. Of those 50, if the result comes back positive (wolf detected), split in half again, testing 25 pooled together. If this comes back positive, either 12 or 13 ofthe positive group. You see where this is going. Any negative results rule out all sheep in that group. Worst case scenario, it takes 54 tests (see image for explanation). Best case scenario, you get 14 tests. Price range: 14,000 - 54,000 dollars.




Not sure yet of the expected average, but I know this is better than 99 tests on average.



Diagram:




sheep.jpg




If this isn't the optimal solution, then my best bet on how to improve it would be to:




split into 1/5 the size of each group.







share|improve this answer









$endgroup$













  • $begingroup$
    I do not consider it much of a spoiler (there must be better algorithms) but the worst case scenario can be easily reduced to 35 tests. rot13(Qb ovanel frnepurf sbe bar jbys. Rnpu frnepu vf qbar ba nyy gur furrc zvahf jbysf sbhaq va gur cerivbhf frnepurf. Lbh jvyy arrq 5 frnepurf. Rnpu frnepu jvyy gnxr ng zbfg 7 grfgf. Fb gur jbefg pnfr fpranevb vf 35 grfgf).
    $endgroup$
    – ppgdev
    1 hour ago










  • $begingroup$
    Wait a minute, how would that work? Could you be a little more specific?
    $endgroup$
    – user45266
    1 hour ago










  • $begingroup$
    @ppgdev Like starting with 100, you split the group into 5 groups? What do you mean?
    $endgroup$
    – user45266
    59 mins ago










  • $begingroup$
    I moved my comment into an upper bound answer, with a more detailed explanation.
    $endgroup$
    – ppgdev
    42 mins ago
















1












$begingroup$

Here's my shot at it:




Pool 50 of the sheep. Of those 50, if the result comes back positive (wolf detected), split in half again, testing 25 pooled together. If this comes back positive, either 12 or 13 ofthe positive group. You see where this is going. Any negative results rule out all sheep in that group. Worst case scenario, it takes 54 tests (see image for explanation). Best case scenario, you get 14 tests. Price range: 14,000 - 54,000 dollars.




Not sure yet of the expected average, but I know this is better than 99 tests on average.



Diagram:




sheep.jpg




If this isn't the optimal solution, then my best bet on how to improve it would be to:




split into 1/5 the size of each group.







share|improve this answer









$endgroup$













  • $begingroup$
    I do not consider it much of a spoiler (there must be better algorithms) but the worst case scenario can be easily reduced to 35 tests. rot13(Qb ovanel frnepurf sbe bar jbys. Rnpu frnepu vf qbar ba nyy gur furrc zvahf jbysf sbhaq va gur cerivbhf frnepurf. Lbh jvyy arrq 5 frnepurf. Rnpu frnepu jvyy gnxr ng zbfg 7 grfgf. Fb gur jbefg pnfr fpranevb vf 35 grfgf).
    $endgroup$
    – ppgdev
    1 hour ago










  • $begingroup$
    Wait a minute, how would that work? Could you be a little more specific?
    $endgroup$
    – user45266
    1 hour ago










  • $begingroup$
    @ppgdev Like starting with 100, you split the group into 5 groups? What do you mean?
    $endgroup$
    – user45266
    59 mins ago










  • $begingroup$
    I moved my comment into an upper bound answer, with a more detailed explanation.
    $endgroup$
    – ppgdev
    42 mins ago














1












1








1





$begingroup$

Here's my shot at it:




Pool 50 of the sheep. Of those 50, if the result comes back positive (wolf detected), split in half again, testing 25 pooled together. If this comes back positive, either 12 or 13 ofthe positive group. You see where this is going. Any negative results rule out all sheep in that group. Worst case scenario, it takes 54 tests (see image for explanation). Best case scenario, you get 14 tests. Price range: 14,000 - 54,000 dollars.




Not sure yet of the expected average, but I know this is better than 99 tests on average.



Diagram:




sheep.jpg




If this isn't the optimal solution, then my best bet on how to improve it would be to:




split into 1/5 the size of each group.







share|improve this answer









$endgroup$



Here's my shot at it:




Pool 50 of the sheep. Of those 50, if the result comes back positive (wolf detected), split in half again, testing 25 pooled together. If this comes back positive, either 12 or 13 ofthe positive group. You see where this is going. Any negative results rule out all sheep in that group. Worst case scenario, it takes 54 tests (see image for explanation). Best case scenario, you get 14 tests. Price range: 14,000 - 54,000 dollars.




Not sure yet of the expected average, but I know this is better than 99 tests on average.



Diagram:




sheep.jpg




If this isn't the optimal solution, then my best bet on how to improve it would be to:




split into 1/5 the size of each group.








share|improve this answer












share|improve this answer



share|improve this answer










answered 1 hour ago









user45266user45266

32514




32514












  • $begingroup$
    I do not consider it much of a spoiler (there must be better algorithms) but the worst case scenario can be easily reduced to 35 tests. rot13(Qb ovanel frnepurf sbe bar jbys. Rnpu frnepu vf qbar ba nyy gur furrc zvahf jbysf sbhaq va gur cerivbhf frnepurf. Lbh jvyy arrq 5 frnepurf. Rnpu frnepu jvyy gnxr ng zbfg 7 grfgf. Fb gur jbefg pnfr fpranevb vf 35 grfgf).
    $endgroup$
    – ppgdev
    1 hour ago










  • $begingroup$
    Wait a minute, how would that work? Could you be a little more specific?
    $endgroup$
    – user45266
    1 hour ago










  • $begingroup$
    @ppgdev Like starting with 100, you split the group into 5 groups? What do you mean?
    $endgroup$
    – user45266
    59 mins ago










  • $begingroup$
    I moved my comment into an upper bound answer, with a more detailed explanation.
    $endgroup$
    – ppgdev
    42 mins ago


















  • $begingroup$
    I do not consider it much of a spoiler (there must be better algorithms) but the worst case scenario can be easily reduced to 35 tests. rot13(Qb ovanel frnepurf sbe bar jbys. Rnpu frnepu vf qbar ba nyy gur furrc zvahf jbysf sbhaq va gur cerivbhf frnepurf. Lbh jvyy arrq 5 frnepurf. Rnpu frnepu jvyy gnxr ng zbfg 7 grfgf. Fb gur jbefg pnfr fpranevb vf 35 grfgf).
    $endgroup$
    – ppgdev
    1 hour ago










  • $begingroup$
    Wait a minute, how would that work? Could you be a little more specific?
    $endgroup$
    – user45266
    1 hour ago










  • $begingroup$
    @ppgdev Like starting with 100, you split the group into 5 groups? What do you mean?
    $endgroup$
    – user45266
    59 mins ago










  • $begingroup$
    I moved my comment into an upper bound answer, with a more detailed explanation.
    $endgroup$
    – ppgdev
    42 mins ago
















$begingroup$
I do not consider it much of a spoiler (there must be better algorithms) but the worst case scenario can be easily reduced to 35 tests. rot13(Qb ovanel frnepurf sbe bar jbys. Rnpu frnepu vf qbar ba nyy gur furrc zvahf jbysf sbhaq va gur cerivbhf frnepurf. Lbh jvyy arrq 5 frnepurf. Rnpu frnepu jvyy gnxr ng zbfg 7 grfgf. Fb gur jbefg pnfr fpranevb vf 35 grfgf).
$endgroup$
– ppgdev
1 hour ago




$begingroup$
I do not consider it much of a spoiler (there must be better algorithms) but the worst case scenario can be easily reduced to 35 tests. rot13(Qb ovanel frnepurf sbe bar jbys. Rnpu frnepu vf qbar ba nyy gur furrc zvahf jbysf sbhaq va gur cerivbhf frnepurf. Lbh jvyy arrq 5 frnepurf. Rnpu frnepu jvyy gnxr ng zbfg 7 grfgf. Fb gur jbefg pnfr fpranevb vf 35 grfgf).
$endgroup$
– ppgdev
1 hour ago












$begingroup$
Wait a minute, how would that work? Could you be a little more specific?
$endgroup$
– user45266
1 hour ago




$begingroup$
Wait a minute, how would that work? Could you be a little more specific?
$endgroup$
– user45266
1 hour ago












$begingroup$
@ppgdev Like starting with 100, you split the group into 5 groups? What do you mean?
$endgroup$
– user45266
59 mins ago




$begingroup$
@ppgdev Like starting with 100, you split the group into 5 groups? What do you mean?
$endgroup$
– user45266
59 mins ago












$begingroup$
I moved my comment into an upper bound answer, with a more detailed explanation.
$endgroup$
– ppgdev
42 mins ago




$begingroup$
I moved my comment into an upper bound answer, with a more detailed explanation.
$endgroup$
– ppgdev
42 mins ago











0












$begingroup$

There must be better algorithms, but just to put an upper bound on a solution, the worst case scenario can be reduced to




35 tests. Do binary searches for one wolf. Each search is done on all the sheep minus wolfs found in the previous searches. So the first binary search is done on a set of all 100 'sheep'. You will find a wolf in no more than 7 tests. The next binary search is done on remaining 99 sheep. And so on. You will need 5 binary searches. Each search will take at most 7 tests. So the worst case scenario is 35 tests.







share|improve this answer









$endgroup$













  • $begingroup$
    Unfortunately that will not actually work. The problem states you will only get the results of the tests after all the tests have been done (maybe it takes a few days for the results to come through!), so you can’t base your second test on the results of the first one.
    $endgroup$
    – Amorydai
    14 mins ago










  • $begingroup$
    @Amorydai, you are right. I missed what was stated in bold font :-). Removing my answer and comments.
    $endgroup$
    – ppgdev
    6 mins ago
















0












$begingroup$

There must be better algorithms, but just to put an upper bound on a solution, the worst case scenario can be reduced to




35 tests. Do binary searches for one wolf. Each search is done on all the sheep minus wolfs found in the previous searches. So the first binary search is done on a set of all 100 'sheep'. You will find a wolf in no more than 7 tests. The next binary search is done on remaining 99 sheep. And so on. You will need 5 binary searches. Each search will take at most 7 tests. So the worst case scenario is 35 tests.







share|improve this answer









$endgroup$













  • $begingroup$
    Unfortunately that will not actually work. The problem states you will only get the results of the tests after all the tests have been done (maybe it takes a few days for the results to come through!), so you can’t base your second test on the results of the first one.
    $endgroup$
    – Amorydai
    14 mins ago










  • $begingroup$
    @Amorydai, you are right. I missed what was stated in bold font :-). Removing my answer and comments.
    $endgroup$
    – ppgdev
    6 mins ago














0












0








0





$begingroup$

There must be better algorithms, but just to put an upper bound on a solution, the worst case scenario can be reduced to




35 tests. Do binary searches for one wolf. Each search is done on all the sheep minus wolfs found in the previous searches. So the first binary search is done on a set of all 100 'sheep'. You will find a wolf in no more than 7 tests. The next binary search is done on remaining 99 sheep. And so on. You will need 5 binary searches. Each search will take at most 7 tests. So the worst case scenario is 35 tests.







share|improve this answer









$endgroup$



There must be better algorithms, but just to put an upper bound on a solution, the worst case scenario can be reduced to




35 tests. Do binary searches for one wolf. Each search is done on all the sheep minus wolfs found in the previous searches. So the first binary search is done on a set of all 100 'sheep'. You will find a wolf in no more than 7 tests. The next binary search is done on remaining 99 sheep. And so on. You will need 5 binary searches. Each search will take at most 7 tests. So the worst case scenario is 35 tests.








share|improve this answer












share|improve this answer



share|improve this answer










answered 44 mins ago









ppgdevppgdev

41516




41516












  • $begingroup$
    Unfortunately that will not actually work. The problem states you will only get the results of the tests after all the tests have been done (maybe it takes a few days for the results to come through!), so you can’t base your second test on the results of the first one.
    $endgroup$
    – Amorydai
    14 mins ago










  • $begingroup$
    @Amorydai, you are right. I missed what was stated in bold font :-). Removing my answer and comments.
    $endgroup$
    – ppgdev
    6 mins ago


















  • $begingroup$
    Unfortunately that will not actually work. The problem states you will only get the results of the tests after all the tests have been done (maybe it takes a few days for the results to come through!), so you can’t base your second test on the results of the first one.
    $endgroup$
    – Amorydai
    14 mins ago










  • $begingroup$
    @Amorydai, you are right. I missed what was stated in bold font :-). Removing my answer and comments.
    $endgroup$
    – ppgdev
    6 mins ago
















$begingroup$
Unfortunately that will not actually work. The problem states you will only get the results of the tests after all the tests have been done (maybe it takes a few days for the results to come through!), so you can’t base your second test on the results of the first one.
$endgroup$
– Amorydai
14 mins ago




$begingroup$
Unfortunately that will not actually work. The problem states you will only get the results of the tests after all the tests have been done (maybe it takes a few days for the results to come through!), so you can’t base your second test on the results of the first one.
$endgroup$
– Amorydai
14 mins ago












$begingroup$
@Amorydai, you are right. I missed what was stated in bold font :-). Removing my answer and comments.
$endgroup$
– ppgdev
6 mins ago




$begingroup$
@Amorydai, you are right. I missed what was stated in bold font :-). Removing my answer and comments.
$endgroup$
– ppgdev
6 mins ago


















draft saved

draft discarded




















































Thanks for contributing an answer to Puzzling Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fpuzzling.stackexchange.com%2fquestions%2f81737%2fwolves-and-sheep%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Paper upload error, “Upload failed: The top margin is 0.715 in on page 3, which is below the required...

Emraan Hashmi Filmografia | Linki zewnętrzne | Menu nawigacyjneGulshan GroverGulshan...

How can I write this formula?newline and italics added with leqWhy does widehat behave differently if I...