Re: [algogeeks] help required...

2010-09-23 Thread santhosh
if the possibilty of a person knowing other any1 based circular linked.. ie.
1/n..
then none becomes celebrity .. so wat to do in tat situation??

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

2009-08-15 Thread santhosh venkat
@ Sharad
 I think the replier's logic and explanation for the same can be found here
.
 http://www.topcoder.com/tc?module=Staticd1=tutorialsd2=algorithmGames
Besides i think dp can also be applied here .but it needs lot of memory
 Santhosh .

On Sat, Aug 15, 2009 at 8:42 PM, sharad kumar aryansmit3...@gmail.comwrote:

 pls explain a bit.suppose there aare 2 baskets and lets assume 12 eggs
 in basket 1 and 15 in b2.wat will u do


 On Sat, Aug 15, 2009 at 8:33 PM, Arun N arunn3...@gmail.com wrote:

 this is same as NIM
 the concept is Grundy Numbers
 just xor all the numbers
 if it is zero 1st player will lose
 else 1st player will win
 assuming both play optimally

 Arun,

 On Fri, Aug 14, 2009 at 7:50 PM, sharad kumar aryansmit3...@gmail.comwrote:

 both

 On Fri, Aug 14, 2009 at 7:35 PM, ganesa thandavam 
 gthanda...@gmail.comwrote:


 is the number of eggs same in all baskets ???

 On Aug 14, 7:00 pm, sharad kumar aryansmit3...@gmail.com wrote:
  There are N egg baskets and the number of eggs in each basket is a
 known
  quantity. Two players take turns to remove these eggs from the
 baskets. On
  each turn, a player must remove at least one egg, and may remove any
 number
  of eggs provided they all belong to the same basket. The player
 picking the
  last egg(s) wins the game. If you are allowed to decide who is going
 to
  start first, what mathematical function would you use to decide so
 that you
  end up on the winning side?








 --
 Potential is not what U have, its what U think U have!!!
 It is better to worn out than rust.






 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@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
-~--~~~~--~~--~--~---



[algogeeks] Re: Check divisibility by 3

2009-08-14 Thread santhosh venkat
given a number n
 u can get the quotient when it is divided by 4 using right shift 2 times
like n  2 this ll give u quotient(q)
u can get the remainder by subtracting 4 * q from n which will give  the
remainder when divided by 4

by doing this u ll express n as n = 4q + r  = 3q + (q+r)
in this already 3q which is divisible by 3 .. u can apply the same logic
recursively to q+r and return the remainder obtained for q+r..


On Fri, Aug 14, 2009 at 7:11 PM, Yogesh Aggarwal 
yogesh.aggarwa...@gmail.com wrote:

 @arun : we are not supposed to use / operator. but in ur algo u r using /
 or %  has to be used to check wether the diff is divisible by 3.
 We can do like dis...
 - add all d digits of the no.
 - if the result is less than 10, add all the digits of the result again.
 - continue step2 if the result is still less than 10
 - if the result is either 0, 3 , 6 or 9 den the no. is divisible by 3.

 example 1 :
 num = 12345
 sum1 = 15 (sum  10)
 sum2 = 6
 since sum  10, we stop here and since final sum = 6 so the given no.
 is divisible by 3


 On Fri, Aug 14, 2009 at 3:09 PM, Arun N arunn3...@gmail.com wrote:

 take an number find its binary
 add all odd bits and even bits seperately
 now check if the difference is divisible by 3
 if yes it is
 say 6 110  -  1+0 - 1 =0
 9 1001 - 1+0 - 0+1 = 0
 12 1100  -- 1+0 - 1+0  = 0
 Arun,

 On Fri, Aug 14, 2009 at 1:15 PM, richa gupta richa.cs...@gmail.comwrote:


 can we check the divisibility of a given number by 3 withoutusing
 operators like '/' or '%'.
 I want the efficient solution to this problem ..

 can someone help ??
 --
 Richa Gupta
 (IT-BHU,India)





 --
 Potential is not what U have, its what U think U have!!!
 It is better to worn out than rust.







 --
 Best Wishes  Regards
 Thank You
 Yogesh Aggarwal
 B.Tech(IT),
 University School of Information Technology
 GGS Indraprastha University
 Delhi
 mailto: yogesh.aggarwa...@gmail.com
 #9990956582

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@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
-~--~~~~--~~--~--~---



[algogeeks] Re: Check divisibility by 3

2009-08-14 Thread santhosh venkat
 i think itoa  wont work for long long type and as far i know it is designed
to work only for integers only... so u cant find remainder for longer
numbers with the logic  u said above
On Fri, Aug 14, 2009 at 7:36 PM, sharad kumar aryansmit3...@gmail.comwrote:

 say withou itoa yaar.


 On Fri, Aug 14, 2009 at 7:35 PM, Yogesh Aggarwal 
 yogesh.aggarwa...@gmail.com wrote:

 u can use the itoa function for that...


 On Fri, Aug 14, 2009 at 7:31 PM, sharad kumar aryansmit3...@gmail.comwrote:

 brother how do u get the digits of number ???u use % and / rite??


  On Fri, Aug 14, 2009 at 7:28 PM, Yogesh Aggarwal 
 yogesh.aggarwa...@gmail.com wrote:

 (CORRECTED ALGO.)
  We can do like dis...
 - add all d digits of the no.
 - if the result is MORE than 10, add all the digits of the result again.
 - continue step2 if the result is still MORE than 10
 - if the result is either 0, 3 , 6 or 9 den the no. is divisible by 3.

 example 1 :
 num = 12345
 sum1 = 15 (sum  10)
 sum2 = 6
 since sum  10, we stop here and since final sum = 6 so the given
 no. is divisible by 3


 On Fri, Aug 14, 2009 at 7:25 PM, Yogesh Aggarwal 
 yogesh.aggarwa...@gmail.com wrote:

 (CORRECTED ALGO.)
 We can do like dis...
 - add all d digits of the no.
 - if the result is MORE than 10, add all the digits of the result
 again.
 - continue step2 if the result is still less than 10
 - if the result is either 0, 3 , 6 or 9 den the no. is divisible by 3.

 example 1 :
 num = 12345
 sum1 = 15 (sum  10)
 sum2 = 6
 since sum  10, we stop here and since final sum = 6 so the given
 no. is divisible by 3

 On Fri, Aug 14, 2009 at 7:20 PM, santhosh venkat 
 santhoshvenkat1...@gmail.com wrote:

 given a number n
  u can get the quotient when it is divided by 4 using right shift 2
 times
 like n  2 this ll give u quotient(q)
 u can get the remainder by subtracting 4 * q from n which will give
 the remainder when divided by 4

 by doing this u ll express n as n = 4q + r  = 3q + (q+r)
 in this already 3q which is divisible by 3 .. u can apply the same
 logic recursively to q+r and return the remainder obtained for q+r..


 On Fri, Aug 14, 2009 at 7:11 PM, Yogesh Aggarwal 
 yogesh.aggarwa...@gmail.com wrote:

 @arun : we are not supposed to use / operator. but in ur algo u r
 using / or %  has to be used to check wether the diff is divisible by 3.
 We can do like dis...
 - add all d digits of the no.
 - if the result is less than 10, add all the digits of the result
 again.
 - continue step2 if the result is still less than 10
 - if the result is either 0, 3 , 6 or 9 den the no. is divisible by
 3.

 example 1 :
 num = 12345
 sum1 = 15 (sum  10)
 sum2 = 6
 since sum  10, we stop here and since final sum = 6 so the given
 no. is divisible by 3


 On Fri, Aug 14, 2009 at 3:09 PM, Arun N arunn3...@gmail.com wrote:

 take an number find its binary
 add all odd bits and even bits seperately
 now check if the difference is divisible by 3
 if yes it is
 say 6 110  -  1+0 - 1 =0
 9 1001 - 1+0 - 0+1 = 0
 12 1100  -- 1+0 - 1+0  = 0
 Arun,

 On Fri, Aug 14, 2009 at 1:15 PM, richa gupta richa.cs...@gmail.com
  wrote:


 can we check the divisibility of a given number by 3 withoutusing
 operators like '/' or '%'.
 I want the efficient solution to this problem ..

 can someone help ??
 --
 Richa Gupta
 (IT-BHU,India)





 --
 Potential is not what U have, its what U think U have!!!
 It is better to worn out than rust.







 --
 Best Wishes  Regards
 Thank You
 Yogesh Aggarwal
 B.Tech(IT),
 University School of Information Technology
 GGS Indraprastha University
 Delhi
 mailto: yogesh.aggarwa...@gmail.com
 #9990956582








 --
 Best Wishes  Regards
 Thank You
 Yogesh Aggarwal
 B.Tech(IT),
 University School of Information Technology
 GGS Indraprastha University
 Delhi
 mailto: yogesh.aggarwa...@gmail.com
 #9990956582




 --
 Best Wishes  Regards
 Thank You
 Yogesh Aggarwal
 B.Tech(IT),
 University School of Information Technology
 GGS Indraprastha University
 Delhi
 mailto: yogesh.aggarwa...@gmail.com
 #9990956582








 --
 Best Wishes  Regards
 Thank You
 Yogesh Aggarwal
 B.Tech(IT),
 University School of Information Technology
 GGS Indraprastha University
 Delhi
 mailto: yogesh.aggarwa...@gmail.com
 #9990956582




 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@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
-~--~~~~--~~--~--~---



[algogeeks] Re: Finding repeated element in most efficient way

2009-08-09 Thread santhosh venkat
http://en.wikipedia.org/wiki/Pigeonhole_sorthttp://en.wikipedia.org/wiki/Pigeonhole_sortI
think it was the repliers intention. But i think it is not the most optimal
way of solving the question as the amount of memory it needs in the worst
case is higher

On Sun, Aug 9, 2009 at 1:47 PM, richa gupta richa.cs...@gmail.com wrote:

 what is this pigeonhole sort ??

 2009/8/9 sharad kumar aryansmit3...@gmail.com

 use pigeonhole sort


 On Sun, Aug 9, 2009 at 12:47 PM, richa gupta richa.cs...@gmail.comwrote:

 Hi,
 An array consists of all unique integers but one. The repeated element
 repeats in the order of two i.e. the repeated integer is 2, 4, 8, 16,
 etc times in the array.
 How to find the repeated element in most efficient way?

 --
 Richa Gupta
 (IT-BHU,India)








 --
 Richa Gupta
 (IT-BHU,India)

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@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
-~--~~~~--~~--~--~---



[algogeeks] Re: Pigeon Hole Principle

2007-03-25 Thread Santhosh Suresh
@Vishal
When you rotate the inner section through it's 200 configurations, each of
the inner section happens to come in tune with each of the outer sections,
so there will 100 'matchings' and 100 mismatches.

On 3/25/07, Vishal [EMAIL PROTECTED] wrote:

 I did assume that the outer disk is painted half (contiguous) red and half
 white.
 However the 'equivalence' should do the trick and the same proof applies.
 As far as Stone's proof goes, I did not understand -
  For each inner section,no matter white or black ,there is 100
  color-matching events.
 Can somebody explain?

 ~Vishal

 On 3/25/07, Prunthaban Kanthakumar [EMAIL PROTECTED] wrote:
 
  Ouch I got the question completely wrong assuming the inner disc is
  continuous.Sorry for the confusion.
 
  On 3/25/07, Prunthaban Kanthakumar  [EMAIL PROTECTED] wrote:
  
   On 3/25/07, Rajiv Mathews [EMAIL PROTECTED] wrote:
   
   
On 3/25/07, Prunthaban Kanthakumar [EMAIL PROTECTED] wrote:
  If you see carefully his proof does not assume anything about
sections
 colored continuously. His proof assumes only one thing Half of
them are
 red and half of them are white
  Half does not mean it should be continuous. So the proof still
works
 correct unmodified even if the halves are not continuous.

   
Could you elaborate please.
His proof contains,  Quote:
If r = R-r, match half1 with Red half of outer disk.
Total matching = r + 100 - R + r = 100 - R + 2*r
How do you justify this if the sections aren't contiguous?
I think the proof elaborated by _stone_ is correct and apt.
  
  
   There is an equivalence
  
   It is simple.Just consider,
   Half1 = All the sections in the outer disc painted red (This is not
   continuous. But nothing prevents you from assuming a non-continuous 100 
   red
   sections as a logical half)
   Half2 = All the sections in the outer disc painted white
  
   Now with this interpretation, read his proof. Just remember that when
   you say 'half' of inner disc it means the sections corresponding to the 
   half
   in the outer disc as defined above. This is the key to establish
   equivalence).
  
   Regards,
   Prunthaban
  
  
   --
   
   
Regards,
Rajiv Mathews
   
   
  
  
  
  

 



-- 
Santhosh S
ME05B045
Dept. of Mechanical Engineering,
IIT Madras,
Chennai-600036

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] Re: Pigeon Hole Principle

2007-03-24 Thread Santhosh Suresh
Yes, I don't think we can assume that the reds and whites are contiguous.
They might be arbitrarily distributed. The only information is that there
are 100 reds and 100 whites.

On 3/25/07, Karthik Singaram L [EMAIL PROTECTED] wrote:


 yes...but that does not mean that you can assume that the 100 reds and
 100 whites are contiguous blocks.It just says that the outer disk has
 a sum of the 100 reds and 100 whites and does not say that they are
 contiguous.

 



-- 
Santhosh S
ME05B045
Dept. of Mechanical Engineering,
IIT Madras,
Chennai-600036

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] Fwd: [algogeeks] Re: the sum of two unsigned integers

2007-01-24 Thread Santhosh Suresh
say, given the limit of the unsigned as  k bits. Find log to base 2^k. If
it's one in both, it'll result in an overflow.
-- Forwarded message --
From: aravind kumar [EMAIL PROTECTED]
Date: Jan 24, 2007 7:10 PM
Subject: [algogeeks] Re: the sum of two unsigned integers
To: algogeeks@googlegroups.com

check if the sum is less than any of the two numbers that means the sum
resulted in a overflow.

On 1/24/07, Abid [EMAIL PROTECTED] wrote:


 This is an interview question.
 What is the simples way to check if the sum of two unsigned integers
 has resulted in an overflow. ?





-- 
Regards
Aravind

Too often we underestimate the power of a touch, a smile, a kind word, a
listening ear, an honest  compliment, or the smallest act of caring, all of
which have the potential to turn a life around.

Do I contradict myself?
Very well then I contradict myself,
I am large, I contain multitudes.
- Walt Whitman



-- 
Santhosh S
ME05B045
Dept. of Mechanical Engineering,
IIT Madras,
Chennai-600036

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups-beta.google.com/group/algogeeks
-~--~~~~--~~--~--~---