[algogeeks] Implement a queue in which push_rear(), pop_front() and get_min() are all constant time operations.

2011-01-01 Thread sourav
Implement a queue in which push_rear(), pop_front() and get_min() are
all constant time operations.

-- 
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 Salil Joshi
@Dave,
Yeah, I had read those numbers on internet as this puzzle is well known.
However I am not convinced with the calculations because of following 2
points:

1) If C shoots in air, the probability of survival is more for the
probabilities considered in the calculations with which A & B will shoot at
him.
Now, if A & B are intelligent, they will know that increasing survival
probability for C is bad for them (you can calculate survival probability
for A & B in each case), and therefore they will shoot at C with higher
probability than what they were planning earlier.

2) C's survival probability depends on P(A shooting at C) * 1 and P(B
shooting at C) * 1/2.
If C shoots at A, P(A shooting at C) is less by 33% and P(B shooting at C)
is more by 33%. So, if P(A shooting at C) dominates by logic in 1st point,
C's survival probability will be now more.



On Sun, Jan 2, 2011 at 7:59 AM, Dave  wrote:

> @Salil: Working out the probabilities, we find that:
>
> 1. If C initially shoots at A, C's probability of survival is ~
> 0.35867.
> 2. If C initially shoots at B, C's probability of survival is ~
> 0.27679.
> 3. If C initially shoots in the air, C's probability of survival is ~
> 0.49624.
>
> Dave
>
> On Jan 1, 11:30 am, Salil Joshi  wrote:
> > @Rahul,
> > As per my understanding,
> > In any round P(C is dead) = P(A is alive * A shoots C * A's shot is
> > accurate) + P(B is alive * B shoots C * B's shot is accurate)
> > this is to be minimized.
> > by not shooting at either A or B in 1st chance, how is this probability
> less
> > for C?
> >
> > On Sat, Jan 1, 2011 at 10:43 PM, Salil Joshi  >wrote:
> >
> >
> >
> >
> >
> > > @Rahul,
> > > What purpose is served by wasting the shot? If C shoots at A or B, at
> least
> > > some probability that C is dead in future will be reduced.
> >
> > > On Sat, Jan 1, 2011 at 10:14 PM, RAHUL KUJUR <
> kujurismonu2...@gmail.com>wrote:
> >
> > >> @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.
> >
> > > --
> >
> > > 
> > > Thanks & Regards
> > > Salil Joshi.
> > > CSE MTech II, IITB
> > > A-414, Hostel 12
> > > +91.9819.442.865
> >
> > > This is a confidential E-Mail. If it has reached you by mistake or if
> you
> > > are not the intended receiver, please send it back to me.
> >
> > --
> >
> > 
> > Thanks & Regards
> > Salil Joshi.
> > CSE MTech II, IITB
> > A-414, Hostel 12
> > +91.9819.442.865
> >
> > This is a confidential E-Mail. If it has reached you by mistake or if you
> > are not the intended receiver, please send it back to me.- Hide quoted
> text -
> >
> > - Show quoted text -
>
> --
> 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.
>
>


-- 


Thanks & Regards
Salil Joshi.
CSE MTech II, IITB
A-414, Hostel 12
+91.9819.442.865


This is a confidential E-Mail. If it has reached you by mistake or if you
are not the intended receiver, please send it back to me.

-- 
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.goog

Re: [algogeeks] Re: Float Comparison

2011-01-01 Thread Anuj Kumar
we use epsilon in that case as the float values are not exact there is
an approximation.

On 1/2/11, Anuj Kumar  wrote:
> he means ==
>
> On 1/2/11, Dave  wrote:
>> @Saunsh: Why do you say that we cannot use < or > on floats? Of course
>> we can!
>>
>> Dave
>>
>> On Jan 1, 3:06 pm, saunsh  wrote:
>>> how to compare two float variables for equality as wel as for which of
>>> dem has greater value
>>> as we know we can not use < n > operators on float
>>
>> --
>> 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.
>>
>>
>
>
> --
> Anuj Kumar
> Third Year Undergraduate,
> Dept. of Computer Science and Engineering
> NIT Durgapur
>


-- 
Anuj Kumar
Third Year Undergraduate,
Dept. of Computer Science and Engineering
NIT Durgapur

-- 
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: Float Comparison

2011-01-01 Thread Anuj Kumar
he means ==

On 1/2/11, Dave  wrote:
> @Saunsh: Why do you say that we cannot use < or > on floats? Of course
> we can!
>
> Dave
>
> On Jan 1, 3:06 pm, saunsh  wrote:
>> how to compare two float variables for equality as wel as for which of
>> dem has greater value
>> as we know we can not use < n > operators on float
>
> --
> 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.
>
>


-- 
Anuj Kumar
Third Year Undergraduate,
Dept. of Computer Science and Engineering
NIT Durgapur

-- 
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.



[algogeeks] Re: Float Comparison

2011-01-01 Thread Dave
@Saunsh: Why do you say that we cannot use < or > on floats? Of course
we can!

Dave

On Jan 1, 3:06 pm, saunsh  wrote:
> how to compare two float variables for equality as wel as for which of
> dem has greater value
> as we know we can not use < n > operators on float

-- 
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.



[algogeeks] Re: probability

2011-01-01 Thread Dave
@Salil: Working out the probabilities, we find that:

1. If C initially shoots at A, C's probability of survival is ~
0.35867.
2. If C initially shoots at B, C's probability of survival is ~
0.27679.
3. If C initially shoots in the air, C's probability of survival is ~
0.49624.

Dave

On Jan 1, 11:30 am, Salil Joshi  wrote:
> @Rahul,
> As per my understanding,
> In any round P(C is dead) = P(A is alive * A shoots C * A's shot is
> accurate) + P(B is alive * B shoots C * B's shot is accurate)
> this is to be minimized.
> by not shooting at either A or B in 1st chance, how is this probability less
> for C?
>
> On Sat, Jan 1, 2011 at 10:43 PM, Salil Joshi wrote:
>
>
>
>
>
> > @Rahul,
> > What purpose is served by wasting the shot? If C shoots at A or B, at least
> > some probability that C is dead in future will be reduced.
>
> > On Sat, Jan 1, 2011 at 10:14 PM, RAHUL KUJUR 
> > wrote:
>
> >> @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.
>
> > --
>
> > 
> > Thanks & Regards
> > Salil Joshi.
> > CSE MTech II, IITB
> > A-414, Hostel 12
> > +91.9819.442.865
>
> > This is a confidential E-Mail. If it has reached you by mistake or if you
> > are not the intended receiver, please send it back to me.
>
> --
>
> 
> Thanks & Regards
> Salil Joshi.
> CSE MTech II, IITB
> A-414, Hostel 12
> +91.9819.442.865
>
> This is a confidential E-Mail. If it has reached you by mistake or if you
> are not the intended receiver, please send it back to me.- Hide quoted text -
>
> - Show quoted text -

-- 
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] Plz Explain The Output.

2011-01-01 Thread aniket chatterjee
2.

#include
using namespace std;
int main(){
int n = 255, i;
char *p = (char *)&n;
for(i = 0; i < sizeof(int); i++)
cout<<(unsigned int)p[i]<<"\n";
cin.get();
return 0;
}


Output:
4294967295
0
0
0

I think p[0] is .So why it is giving 4294967295 in the first line.

-- 
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.



[algogeeks] Plz Explain The Output.

2011-01-01 Thread Aniket
# include 
#include
#define concatinate(a,b) a##b
#define same1(a) #a
#define same2(a) same1(a)


int main(){
printf("%s\n",same2(concatinate(1,2)));
printf("%s\n",same1(concatinate(1,2)));
getch();
return 0;
}

Output is:
12
concatinate(1,2)

-- 
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.



[algogeeks] Float Comparison

2011-01-01 Thread saunsh
how to compare two float variables for equality as wel as for which of
dem has greater value
as we know we can not use < n > operators on float

-- 
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.



[algogeeks] Re: arrays

2011-01-01 Thread juver++
You mentioned EXPECTED time, not the worst case.

-- 
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 Salil Joshi
@Rahul,
As per my understanding,
In any round P(C is dead) = P(A is alive * A shoots C * A's shot is
accurate) + P(B is alive * B shoots C * B's shot is accurate)
this is to be minimized.
by not shooting at either A or B in 1st chance, how is this probability less
for C?


On Sat, Jan 1, 2011 at 10:43 PM, Salil Joshi wrote:

> @Rahul,
> What purpose is served by wasting the shot? If C shoots at A or B, at least
> some probability that C is dead in future will be reduced.
>
>
>
> On Sat, Jan 1, 2011 at 10:14 PM, RAHUL KUJUR wrote:
>
>> @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.
>>
>
>
>
> --
>
> 
> Thanks & Regards
> Salil Joshi.
> CSE MTech II, IITB
> A-414, Hostel 12
> +91.9819.442.865
>
>
> This is a confidential E-Mail. If it has reached you by mistake or if you
> are not the intended receiver, please send it back to me.
>



-- 


Thanks & Regards
Salil Joshi.
CSE MTech II, IITB
A-414, Hostel 12
+91.9819.442.865


This is a confidential E-Mail. If it has reached you by mistake or if you
are not the intended receiver, please send it back to me.

-- 
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] arrays

2011-01-01 Thread coolfrog$
yes O(n) solution posible..
1. traverse the first array..
2. for(i=1;i<=n;i++)
 {  X[a[i]] = i ;
 }
3. print array X[];
On Sat, Jan 1, 2011 at 10:42 PM, Soumya Prasad Ukil
wrote:

> Is the second array really required, assuming intersection of both A & B is
> equal to either A or B?
>
> How about X[a[i]] = i?
>
>
> On 27 December 2010 21:24, Anand  wrote:
>
>> I have a two arrays
>>
>> One is
>>
>> 2 5 1 6 4 3
>>
>> other is
>>
>> 1 2 3 4 5 6.
>>
>> I want to make an array X which gives the index of its element on other
>> arrays.
>>
>> Meaning X[1] = 3  1 is element of the second array and 3 is the index of
>> element 1 in first array.
>>
>> How shall we get array X in O(nlogn).
>>
>>  --
>> 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.
>>
>
>
>
> --
> regards,
> soumya prasad ukil
>
>  --
> 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.
>



-- 
*Divesh*
(¨`·.·´¨) Always
  `·.¸(¨`·.·´¨ ) Keep
  (¨`·.·´¨)¸.·´Smiling!
   `·.¸.·´" Life can give u 100's of reason 2cry,but u can give life 1000's
of reasons 2Smile"

-- 
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 Salil Joshi
@Rahul,
What purpose is served by wasting the shot? If C shoots at A or B, at least
some probability that C is dead in future will be reduced.


On Sat, Jan 1, 2011 at 10:14 PM, RAHUL KUJUR wrote:

> @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.
>



-- 


Thanks & Regards
Salil Joshi.
CSE MTech II, IITB
A-414, Hostel 12
+91.9819.442.865


This is a confidential E-Mail. If it has reached you by mistake or if you
are not the intended receiver, please send it back to me.

-- 
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] arrays

2011-01-01 Thread Soumya Prasad Ukil
Is the second array really required, assuming intersection of both A & B is
equal to either A or B?

How about X[a[i]] = i?

On 27 December 2010 21:24, Anand  wrote:

> I have a two arrays
>
> One is
>
> 2 5 1 6 4 3
>
> other is
>
> 1 2 3 4 5 6.
>
> I want to make an array X which gives the index of its element on other
> arrays.
>
> Meaning X[1] = 3  1 is element of the second array and 3 is the index of
> element 1 in first array.
>
> How shall we get array X in O(nlogn).
>
>  --
> 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.
>



-- 
regards,
soumya prasad ukil

-- 
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] Re: probability

2011-01-01 Thread Salil Joshi
@Rahul:
We (Dave and me) saw your reply as joke ... it doesn't make any sense
seriously speaking.
Even if C wastes his shot, A and B can still shoot him... by wasting it, C
will be in loss.


On Sat, Jan 1, 2011 at 8:49 PM, RAHUL KUJUR wrote:

> @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.
>



-- 


Thanks & Regards
Salil Joshi.
CSE MTech II, IITB
A-414, Hostel 12
+91.9819.442.865


This is a confidential E-Mail. If it has reached you by mistake or if you
are not the intended receiver, please send it back to me.

-- 
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 Salil Joshi
well, since it is not mentioned that everyone gets to shoot only once, C can
keep shooting A & B until both are dead... case solved :-))

On Sat, Jan 1, 2011 at 8:29 PM, Dave  wrote:

> @Rahul: If shooter C shoots into the air, doesn't he still have only a
> 33% chance of hitting it? If so, then he would have a 67% chance of
> hitting B or C, or, I suppose, himself. :-)
>
> This brings up another alternative. In round 1 he shoots himself in
> the foot. If he is successful (33% of the time), he is certain to
> survive the duel because he is out as soon as he is hit. If he is
> unsuccessful (67% of the time), the result is the same as if he had
> shot into the air, i.e., he survives with probability 66/133 ~=
> 0.49624. Putting this all together, by shooting himself in the foot,
> his probability of survival increases to about 0.66248. :-)
>
> Dave
>
> On Jan 1, 6:58 am, RAHUL KUJUR  wrote:
> > 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.
>
>


-- 


Thanks & Regards
Salil Joshi.
CSE MTech II, IITB
A-414, Hostel 12
+91.9819.442.865


This is a confidential E-Mail. If it has reached you by mistake or if you
are not the intended receiver, please send it back to me.

-- 
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.



[algogeeks] Re: probability

2011-01-01 Thread Dave
@Rahul: If shooter C shoots into the air, doesn't he still have only a
33% chance of hitting it? If so, then he would have a 67% chance of
hitting B or C, or, I suppose, himself. :-)

This brings up another alternative. In round 1 he shoots himself in
the foot. If he is successful (33% of the time), he is certain to
survive the duel because he is out as soon as he is hit. If he is
unsuccessful (67% of the time), the result is the same as if he had
shot into the air, i.e., he survives with probability 66/133 ~=
0.49624. Putting this all together, by shooting himself in the foot,
his probability of survival increases to about 0.66248. :-)

Dave

On Jan 1, 6:58 am, RAHUL KUJUR  wrote:
> 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] probability

2011-01-01 Thread Salil Joshi
hahaha... lol... shoot in air ... lamo :-))



On Sat, Jan 1, 2011 at 6:28 PM, RAHUL KUJUR wrote:

> 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.
>



-- 


Thanks & Regards
Salil Joshi.
CSE MTech II, IITB
A-414, Hostel 12
+91.9819.442.865


This is a confidential E-Mail. If it has reached you by mistake or if you
are not the intended receiver, please send it back to me.

-- 
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] 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] Fwd: [ƒƒÖ]™ HaPpY NeW YeAr 2011

2011-01-01 Thread Umer Farooq
Thanks for the wishes. Same to you guys too. May this year bring happiness
and prosperity into your lives.

On Sat, Jan 1, 2011 at 2:27 PM, sudhir mishra wrote:

> thank u,wish u the same
>
>
> --
> *
> Thanks & Regards...
> Sudhir Mishra
> undergraduate student,
> Department Of **Computer Science and engineering,*
> *Motilal Nehru National institute Of Technology-ALLAHABAD.
>
> *
>
>
>
>  --
> 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.
>



-- 
Umer

-- 
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] Fwd: [ƒƒÖ]™ HaPpY NeW YeAr 2011

2011-01-01 Thread sudhir mishra
thank u,wish u the same


-- 
*
Thanks & Regards...
Sudhir Mishra
undergraduate student,
Department Of **Computer Science and engineering,*
*Motilal Nehru National institute Of Technology-ALLAHABAD.

*

-- 
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.