Re: [algogeeks] probability

2011-01-01 Thread RAHUL KUJUR
Suppose three gunmen are A, B, and C who have a probability of 100%, 50% and
33% respectively. The shooting will start from C, then B and at last A.
Now there are several possibilities for C. If C shoots B, then A would shoot
C with an accuracy of 100% or in other case if C shoots A, then B would
shoot him with an accuracy of 50%. So he has a probability of getting
killed. We can see in either of the cases C will die.
So what C will do in first round is that it will fire the shot in air. Now
the scenario gets interesting. By doing this C has turned the battle among
three people into two people A and B. This will increase the chances of
survival of C. So now its B's turn of firing. So he can fire at either A or
C. If B fires at C, then A will shoot B with an accuracy of 100% and B knows
that he will surely die so B won't do that. If B shoots A, then C will shoot
B.
I think this is the solution. Please point out if there are any loopholes.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: probability

2011-01-01 Thread RAHUL KUJUR
@Dave: first of all By shooting in air I meant that C will not fire any
one. That was my figure of speech:))
He will simply waste his shot.
@Salil: its a duel. everyone will get chance to shoot in each round

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: probability

2011-01-01 Thread RAHUL KUJUR
@snehal:
will the shooting take place in increasing order of accuracy of hitting the
target and is that at a time only one person can take a shot???
if yes then
@Salil:
my answer would be the same as above. what C will do is that it will first
let A and B kill each other first.
After C wastes his shot it will be B's turn. B can kill C, but in that case
the turn would go to A and he would surely kill B. If B goes after A, then B
may hit it or miss it(as its probability of hitting is 50%)
If B misses it
then
it depends on A whom to kill. A may kill B or C. A will try to kill one who
is better shooter i.e. B as C is less likely to hit A.
If B hits A then we are done. Round 1 is complete(as required in the
question) and C survives the first round.
Look the problem is not that who gets killed at last but rather what C
should fire in the first round obviously to survive(as I understood the
problem). It may happen that eventually C gets killed. But what should C
shoot in first round to survive.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] spy in the city

2010-12-19 Thread RAHUL KUJUR
Is there any condition that the people in the city may or may not know each
other???

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: C aps ques

2010-12-14 Thread RAHUL KUJUR
for 2nd problem:
statement inside the do-while is executed once. Now for the condition
checking inside the while loop. The condition i++5 is evaluated which turns
out to be true. So the rest of the part ++ch='F' is not evaluated and hence
letter A is printed six times. Now when the condition i++5 fails, then
the condition ++ch='F' would be evaluated which prints BCDEF. This is a
property of the logical OR. If the first condition evaluates to true, then
rest of the condition is not evaluated as it would always turn out to be
true. However, if the first condition is false then only the second
condition is checked to get the final output.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: C aps ques

2010-12-14 Thread RAHUL KUJUR
correct me if I am wrong.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Smallest window of K[] in N[]. Best order solution

2010-10-07 Thread RAHUL KUJUR
@prodigy: how is it coming O(nlogk) can u explain???

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Do This

2010-10-06 Thread RAHUL KUJUR
Take two pointers p and q. Initially p points to head.


while(p!=given pointer)
{
p=p-link;
q=p;
};

Now you hv pointer at 3rd and 4th position. Now insertion is simpleHope
this will work

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Do This

2010-10-06 Thread RAHUL KUJUR
@shobhan:  Ya,I got it!!

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.