Re: [algogeeks] Re: linked list

2011-06-29 Thread sunny agrawal
I am not using extra space as i am not allocating new memory for storing Nodes i m using just 2 pointers on the same list, i think that will be allowed On Wed, Jun 29, 2011 at 8:18 PM, Nishant mittal.nishan...@gmail.com wrote: @sunny plz tell me the solution without using extra list...i've

Re: [algogeeks] Re: SPOJ GPA1

2011-06-29 Thread sunny agrawal
/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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

Re: [algogeeks] Printing unique rows.

2011-06-28 Thread sunny agrawal
that means they all are same. Recurrence of the algorithm can be written as follows (considering N rows, M columns and two sub matrix formed contains about half rows T(N,M) = 2T(N/2,M-1) + O(MN) i think TC for this will be O(N^2lgN)...not sure :) Any thing better we can do ?? -- Sunny Aggrawal

Re: [algogeeks] Printing unique rows.

2011-06-28 Thread sunny agrawal
=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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

Re: [algogeeks] Re: Amazon Interview Question

2011-06-28 Thread sunny agrawal
. 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. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you

Re: [algogeeks] Amazon telephonic question

2011-06-28 Thread sunny agrawal
?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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

Re: [algogeeks] Algorithms

2011-06-28 Thread sunny agrawal
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?hl=en. -- Sunny

Re: [algogeeks] Re: given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread sunny agrawal
/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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

Re: [algogeeks] Re: O(n) Time is the problem. ..

2011-06-27 Thread sunny agrawal
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group

Re: [algogeeks] Re: puzzle

2011-06-27 Thread sunny agrawal
. 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. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you

Re: [algogeeks] char *arr and char arr[]

2011-06-25 Thread sunny agrawal
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] Re: O(n) Time is the problem. ..

2011-06-25 Thread sunny agrawal
and Conquer solution can do it in O(n). I just came to know ..thanks i little bit similer to my approachNice One On Sat, Jun 25, 2011 at 9:15 PM, Dave dave_and_da...@juno.com wrote: @Sunny. You are reading too much into that. There is no mention that the data are 32-bit integers

Re: [algogeeks] strange output

2011-06-25 Thread sunny agrawal
. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email

Re: [algogeeks] O(n) Time is the problem. ..

2011-06-24 Thread sunny agrawal
hmm i also doubt that but it is Strictly O(32n) not O(nlgn) where lgn = 32 depending upon value of n On Fri, Jun 24, 2011 at 1:10 PM, rizwan hudda rizwanhu...@gmail.com wrote: @sunny: Think again, your solution will take O(n*log(n)), where log(n) is the number of bits to represent the number

Re: [algogeeks] NEED ALGO IN TIME 0.00

2011-06-24 Thread sunny agrawal
. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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

Re: [algogeeks] Re: O(n) Time is the problem. ..

2011-06-24 Thread sunny agrawal
@Dave it is given in Question that elements of array are integer On Sat, Jun 25, 2011 at 7:17 AM, Dave dave_and_da...@juno.com wrote: @Sunny: What makes you think that the integers are 32 bits in length. Remember that O(.) notation applies as n -- infinity. Thus, O(n log n) is correct

Re: [algogeeks] Re: Sort - Consecutive Array in O(n)

2011-06-24 Thread sunny agrawal
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?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology

Re: [algogeeks] Re: Sort - Consecutive Array in O(n)

2011-06-24 Thread sunny agrawal
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group

Re: [algogeeks] O(n) Time is the problem. ..

2011-06-23 Thread sunny agrawal
. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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

Re: [algogeeks] Re: Amazon - Longest palindrome in a string in O(n)

2011-06-22 Thread sunny agrawal
://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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

Re: [algogeeks] Re: Amazon - Longest palindrome in a string in O(n)

2011-06-22 Thread sunny agrawal
LCS stands for Longest Common Substring -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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

Re: [algogeeks] Re: Amazon - Longest palindrome in a string in O(n)

2011-06-22 Thread sunny agrawal
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. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed

Re: [algogeeks] Binary Tree

2011-06-22 Thread sunny agrawal
:11 AM, oppilas . jatka.oppimi...@gmail.comwrote: Sunny, Can but can we modify this code to get the *node X and node Y*?. On Wed, Jun 22, 2011 at 8:32 AM, Anantha Krishnan ananthakrishnan@gmail.com wrote: @sunny agrawal *Thanks a lot.* *Great code. I got the logic

Re: [algogeeks] string matching

2011-06-22 Thread sunny agrawal
last line is *in worst case k=1 only 2*n comparisons will be there hence O(n)* On Thu, Jun 23, 2011 at 11:26 AM, sunny agrawal sunny816.i...@gmail.comwrote: Lets Consider the case of Naive matching in which at some shift s first k characters are matched and next character does not match so

Re: [algogeeks] Re: finding vlaue of nCr

2011-06-21 Thread sunny agrawal
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] finding vlaue of nCr

2011-06-21 Thread sunny agrawal
://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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

Re: [algogeeks] finding vlaue of nCr

2011-06-21 Thread sunny agrawal
no we can divide also with in the same loop On Tue, Jun 21, 2011 at 3:20 PM, PRAMENDRA RATHi rathi prathi...@gmail.comwrote: @sunny if we calculate (n-r+1)*(n-r+2).*n first and then divide this value by r!.. then this method will fail with little large value of n..because first value

Re: [algogeeks] finding vlaue of nCr

2011-06-21 Thread sunny agrawal
this problem is same as *http://www.codechef.com/problems/MARBLES/* solution to this are public u can check for more clarification On Tue, Jun 21, 2011 at 3:51 PM, sunny agrawal sunny816.i...@gmail.comwrote: if it is given tha final answer fits in 64 bit signed integer then we can run a loop

Re: [algogeeks] finding vlaue of nCr

2011-06-21 Thread sunny agrawal
...@gmail.com wrote: @ sunny i am not getting ur apporach but i am thinking like this.. taking an array from and intilize it to n to n-r a[1000]; int k=0; for(int i=n;i=n-r;i--) a[k++]=i; for(int y=n-r;y1;y--) for(j=0;jk;j++) if(a[j]%y==0) {a[j]=a[j]/y;break;} for example we take

Re: [algogeeks] Re: finding vlaue of nCr

2011-06-21 Thread sunny agrawal
i have already mentioned that if final answer fits in 64 bit integer then it will not overflow On Tue, Jun 21, 2011 at 5:34 PM, Dumanshu duman...@gmail.com wrote: @Sunny: the value can still overflow because Using the while loop u r dividing the res value whenever possible. so the while

Re: [algogeeks] Binary Tree

2011-06-21 Thread sunny agrawal
at http://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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

Re: [algogeeks] Re: Find an element which is not present?

2011-06-21 Thread sunny agrawal
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?hl=en. -- Sunny Aggrawal B

Re: [algogeeks] Re: finding vlaue of nCr

2011-06-21 Thread sunny agrawal
i dont know why r u thinking so but this was my accepted solution for the problem. On Tue, Jun 21, 2011 at 7:34 PM, kartik sachan kartik.sac...@gmail.comwrote: hey sunny suppose u have to calculate 100c50 then there is a lot of chances of over flow becoz u have to multiply 100 to 50

Re: [algogeeks] Re: finding vlaue of nCr

2011-06-21 Thread sunny agrawal
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?hl=en. -- Sunny

Re: [algogeeks] Binary Tree

2011-06-21 Thread sunny agrawal
see this * https://ideone.com/1ZtIq* On Tue, Jun 21, 2011 at 10:23 PM, Anantha Krishnan ananthakrishnan@gmail.com wrote: Thanks. I expect more details in implementation point of view. Thanks Regards, Anantha Krishnan On Tue, Jun 21, 2011 at 6:41 PM, sunny agrawal sunny816.i

Re: [algogeeks] Coin Chain Reaction

2011-06-20 Thread sunny agrawal
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] Coin Chain Reaction

2011-06-20 Thread sunny agrawal
and Expected value should be 2.5^(N-1)*(7/2) -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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

Re: [algogeeks] Tic Tac Toe

2011-06-17 Thread sunny agrawal
to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Re: Tic Tac Toe

2011-06-17 Thread sunny agrawal
will print yes Correct me if i m wrong Test case: XXO XXO ..O Ans: No tell me what is your output for this case On Fri, Jun 17, 2011 at 1:56 PM, KK kunalkapadi...@gmail.com wrote: @sunny: This test: if(! ( (countx == counto + 1) || (countx == counto) ) ) cout no endl

Re: [algogeeks] Re: Tic Tac Toe

2011-06-17 Thread sunny agrawal
kunalkapadi...@gmail.com wrote: @sunny: why the answer for the case u mentioned is no.. those are possible set of moves according to me and hence my program outputs yes -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

Re: [algogeeks] Fiddling with Bits

2011-06-17 Thread sunny agrawal
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] Fiddling with Bits

2011-06-17 Thread sunny agrawal
where n is ?? On Fri, Jun 17, 2011 at 3:23 PM, Arpit Sood soodfi...@gmail.com wrote: i have got AC with O(n) On Fri, Jun 17, 2011 at 2:59 PM, sunny agrawal sunny816.i...@gmail.comwrote: you need to try something better as limits of A and B are very large :) you can not run a loop from

Re: [algogeeks] Fiddling with Bits

2011-06-17 Thread sunny agrawal
but limits of A and B are very large 10^15 how is this possible am i missing something, like Max(B-A) = 10^6 or 10^7 On Fri, Jun 17, 2011 at 3:30 PM, Arpit Sood soodfi...@gmail.com wrote: lol, i mean in linear time On Fri, Jun 17, 2011 at 3:27 PM, sunny agrawal sunny816.i

Re: [algogeeks] Fiddling with Bits

2011-06-17 Thread sunny agrawal
the final result in the order of no of bits O(64) On Fri, Jun 17, 2011 at 3:38 PM, sunny agrawal sunny816.i...@gmail.com wrote: but limits of A and B are very large 10^15 how is this possible am i missing something, like Max(B-A) = 10^6 or 10^7 On Fri, Jun 17, 2011 at 3:30 PM, Arpit Sood

Re: [algogeeks] MS

2011-06-17 Thread sunny agrawal
email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] [brain teaser ] Number Trick Riddle

2011-06-16 Thread sunny agrawal
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?hl=en. -- Sunny

Re: [algogeeks] Re: find output.

2011-06-16 Thread sunny agrawal
/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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

Re: [algogeeks] Re: find output.

2011-06-16 Thread sunny agrawal
yes copy pasting the exact thing :) for better understanding :) On Thu, Jun 16, 2011 at 8:06 PM, Navneet Gupta navneetn...@gmail.comwrote: @Sunny, it is good that you follow Bruce Eckel, but copy pasting the exact thing? :) On Thu, Jun 16, 2011 at 7:34 PM, keyan karthi keyankarthi1

Re: [algogeeks] Re: find output.

2011-06-16 Thread sunny agrawal
@Arpit Thanks to Bruce Eckel :D On Thu, Jun 16, 2011 at 9:00 PM, Arpit Sood soodfi...@gmail.com wrote: @sunny thanks, that post did clear the confusion. On Thu, Jun 16, 2011 at 8:17 PM, Navneet Gupta navneetn...@gmail.comwrote: Then i would suggest you give the original reference

Re: [algogeeks] Re: is it correct??

2011-06-15 Thread sunny agrawal
. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email

Re: [algogeeks] DE Shaw Q

2011-06-15 Thread sunny agrawal
. 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?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute

Re: [algogeeks] DE Shaw Q

2011-06-15 Thread sunny agrawal
consider the case. n = 2; heap 1 - no of coins 1 heap 2 - no of coins 2 On Wed, Jun 15, 2011 at 5:34 PM, sunny agrawal sunny816.i...@gmail.comwrote: i think u r wrong what if heap size -1 is 0 i think one should pick atleast one coin else game will draw On Wed, Jun 15, 2011 at 5:17 PM

Re: [algogeeks] DE Shaw Q

2011-06-15 Thread sunny agrawal
the the heaps are of size 1 the Player 1 can win always. Thanks, Immanuel On Wed, Jun 15, 2011 at 5:36 PM, sunny agrawal sunny816.i...@gmail.comwrote: consider the case. n = 2; heap 1 - no of coins 1 heap 2 - no of coins 2 On Wed, Jun 15, 2011 at 5:34 PM, sunny agrawal sunny816.i

Re: [algogeeks] DE Shaw Q

2011-06-15 Thread sunny agrawal
the other coin from heap1. Player 1 will take both the coins in heap 2. Thanks, Immanuel On Wed, Jun 15, 2011 at 6:33 PM, sunny agrawal sunny816.i...@gmail.comwrote: check out this case n = 2 both heaps having 2 coins player 2 will win i think On Wed, Jun 15, 2011 at 6:26 PM, immanuel

Re: [algogeeks] DE Shaw Q

2011-06-15 Thread sunny agrawal
@Nitish n=2 heap 1 = 2 heap 2 = 3 Xor = 1 still player one can win :) On Wed, Jun 15, 2011 at 6:49 PM, sunny agrawal sunny816.i...@gmail.comwrote: @immanuel ohh, i read the Question wrong. :( i was thinking player1 is starting from least numbered heap and player 2 from highest no heap

Re: [algogeeks] DE Shaw Q

2011-06-15 Thread sunny agrawal
. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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

Re: [algogeeks] DE Shaw Q

2011-06-15 Thread sunny agrawal
no that also wont work n=2 3,1 On Wed, Jun 15, 2011 at 6:59 PM, sunny agrawal sunny816.i...@gmail.comwrote: i think solution depends on no of heaps having single coin if there are even number of such heaps player 1 will win if there are odd number of such heaps player 2 will win On Wed

Re: [algogeeks] Re: Finding shortest path in 4-ary tree

2011-06-15 Thread sunny agrawal
to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] Re: spoj NKTM

2011-06-15 Thread sunny agrawal
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. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed

Re: [algogeeks] Finding shortest path in 4-ary tree

2011-06-14 Thread sunny agrawal
. 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. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you

Re: [algogeeks] Finding shortest path in 4-ary tree

2011-06-14 Thread sunny agrawal
same as left right or top u can consider as each node as a cell of grid type of thing for easy understanding On Tue, Jun 14, 2011 at 5:59 PM, vaibhav agarwal vibhu.bitspil...@gmail.com wrote: What actually is meant by bottom pointer On Tue, Jun 14, 2011 at 5:57 PM, sunny agrawal sunny816.i

Re: [algogeeks] Find shortest substring that is only occurring once. in Given String

2011-06-14 Thread sunny agrawal
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?hl=en. -- Sunny Aggrawal B-Tech

Re: [algogeeks] Re: MS Question

2011-06-14 Thread sunny agrawal
, Arpit Sood soodfi...@gmail.com wrote: i meant if N = { 1, 1, 1, 2, 12} and M = { 1, 1, 3, 12} then answer should be = {1, 1, 12} On Mon, Jun 13, 2011 at 8:06 PM, sunny agrawal sunny816.i...@gmail.comwrote: no we can take care of duplicates without any extra memory modify 2nd step of my

Re: [algogeeks] [brain teaser ] Probability Riddle Loaded Revolver 13 june

2011-06-13 Thread sunny agrawal
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?hl=en. -- Sunny

Re: [algogeeks] Re: How to remove duplicate element from array in one pass.

2011-06-13 Thread sunny agrawal
@ross thanks for clarification... On Mon, Jun 13, 2011 at 2:46 PM, ross jagadish1...@gmail.com wrote: @sunny agarwal: Yes, it would be considered constant space.. even if it required 1MB of space . By big oh notation of space, we mean cases where input size, 'n' tends to infinity

Re: [algogeeks] Re: MS Question

2011-06-13 Thread sunny agrawal
. 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. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you

Re: [algogeeks] Re: MS Question

2011-06-13 Thread sunny agrawal
failures ?? -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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

Re: [algogeeks] help

2011-06-13 Thread sunny agrawal
://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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

Re: [algogeeks] help

2011-06-13 Thread sunny agrawal
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?hl=en. -- Sunny

Re: [algogeeks] Swapping two variables without using a temporary variable

2011-06-13 Thread sunny agrawal
this group at http://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks

Re: [algogeeks] Re: FOR ALL INDIANS PLZ READ IT

2011-06-12 Thread sunny agrawal
Piyush Sinha *ecstasy.piy...@gmail.com * -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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

Re: [algogeeks] [brain teaser ] Find next number in series 10 june

2011-06-11 Thread sunny agrawal
to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups Algorithm

Re: [algogeeks] Algorithm or Program for convert word into number

2011-06-11 Thread sunny agrawal
to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks]

2011-06-10 Thread sunny agrawal
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks]

2011-06-10 Thread sunny agrawal
but that will be O(n) i think On Fri, Jun 10, 2011 at 2:38 PM, Harshal hc4...@gmail.com wrote: can be solved using dfs. On Fri, Jun 10, 2011 at 2:27 PM, sunny agrawal sunny816.i...@gmail.comwrote: find common Ancestor of both. see if y lies on path from x or z to this ancestor O(lgn

Re: [algogeeks]

2011-06-10 Thread sunny agrawal
thats why i mentioned x OR z and i m considering parent pointer :) without parent pointer both solutions will be O(n) :) On Fri, Jun 10, 2011 at 3:02 PM, Harshal hc4...@gmail.com wrote: @Sunny I am assuming that the tree is rooted. There is no 'parent' pointer

Re: [algogeeks]

2011-06-10 Thread sunny agrawal
@ross if a parent pointer is there lca can be found in lgn and path can be traversed in lgn too why it cannot be lgn what is the problem ?? On Fri, Jun 10, 2011 at 3:06 PM, sunny agrawal sunny816.i...@gmail.comwrote: thats why i mentioned x OR z and i m considering parent pointer :) without

Re: [algogeeks] write an algo that deletes all negative integers without changing the order of remaining elements of the queue

2011-06-10 Thread sunny agrawal
, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks

Re: [algogeeks] write an algo that deletes all negative integers without changing the order of remaining elements of the queue

2011-06-10 Thread sunny agrawal
initialy cal size of queue then apply a for loop On Fri, Jun 10, 2011 at 4:00 PM, sunny agrawal sunny816.i...@gmail.comwrote: First algorithm taht comes in mind deque a element if +ve enque again if(-ve) do nothing now question is terminating condition On Fri, Jun 10, 2011 at 3:44 PM

Re: [algogeeks]

2011-06-10 Thread sunny agrawal
using parent pointers untill we reach to lca. On Fri, Jun 10, 2011 at 3:59 PM, aanchal goyal goyal.aanch...@gmail.comwrote: @sunny finding lca in logn is fine, but how can we traverse the path in logn.. ? On Fri, Jun 10, 2011 at 3:50 PM, sunny agrawal sunny816.i...@gmail.comwrote: @ross

Re: [algogeeks] Re: write an algo that deletes all negative integers without changing the order of remaining elements of the queue

2011-06-10 Thread sunny agrawal
=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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

Re: [algogeeks] FOR ALL INDIANS PLZ READ IT

2011-06-09 Thread sunny agrawal
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] solve the series

2011-06-09 Thread sunny agrawal
, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google

Re: [algogeeks] solve the series

2011-06-09 Thread sunny agrawal
series of some random numbers generated ussing some RNG no logic :P :P :P On Thu, Jun 9, 2011 at 12:29 PM, Arpit Sood soodfi...@gmail.com wrote: hey, what's the logic ? On Thu, Jun 9, 2011 at 12:22 PM, sunny agrawal sunny816.i...@gmail.comwrote: 6 On Wed, Jun 8, 2011 at 10:31

Re: [algogeeks] MS Interview

2011-06-09 Thread sunny agrawal
://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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

Re: [algogeeks] MS Interview

2011-06-09 Thread sunny agrawal
yes, but using xor no need of ULL :) 2011/6/9 • » νιρυℓ « • vipulmehta.1...@gmail.com Sum wont overflow, ULL range will include sum. On Thu, Jun 9, 2011 at 3:52 PM, sunny agrawal sunny816.i...@gmail.comwrote: sum can overflow Xor method can also be applied to Q1. no need of numbers

Re: [algogeeks] Finding total number of inversions in an array in O(nlogn) complexity .

2011-06-09 Thread sunny agrawal
to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] logic error:

2011-06-09 Thread sunny agrawal
this group at http://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks

Re: [algogeeks] solve the series

2011-06-09 Thread sunny agrawal
hehe that was also random. :D -- 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

Re: [algogeeks] solve the series

2011-06-09 Thread sunny agrawal
: answer is 6 only bt I don't knw the logic On Thu, Jun 9, 2011 at 5:59 PM, Arpit Sood soodfi...@gmail.com wrote: @sunny since PRG's are also not absolutely random, then did you actually generate series of the form 20 6 150 18 11, or you just answered it randomly, :D @tech rascal what's

Re: [algogeeks] solve the series

2011-06-09 Thread sunny agrawal
seems like got it.. there is 150 days difference between 20/6(20 june) and 18/11(18 November) On Thu, Jun 9, 2011 at 6:14 PM, sunny agrawal sunny816.i...@gmail.comwrote: ha ha . i answer randomly...:) i don't like series questions, but this thread was sleeping so i posted for fun

Re: [algogeeks] Scheduling

2011-06-07 Thread sunny agrawal
. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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

Re: [algogeeks] Samsung Bangalore is hiring a lot!!!!

2011-06-07 Thread sunny agrawal
, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google

Re: [algogeeks] Facebook Q

2011-06-07 Thread sunny agrawal
to same place inverval [i,j) will have equal no of 0's and 1's -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks

Re: [algogeeks] 3 stacks using one array?

2011-06-03 Thread sunny agrawal
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?hl=en. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received

Re: [algogeeks] Google Interview Question

2011-05-30 Thread sunny agrawal
?? -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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

Re: [algogeeks] Re: Binary Tree Problem

2011-05-30 Thread sunny agrawal
won't this simple algo work ?? start from root node, say it has value 0 at any time if a node has a value v pass v-1 to left subtree and v+1 to right subtree keep track of max and min final answer will be max -min = Diameter of tree. correct me if i m wrong. -- You received this message

Re: [algogeeks] Re: Binary Tree Problem

2011-05-30 Thread sunny agrawal
nope, it will not work :( got a case On Mon, May 30, 2011 at 11:57 PM, sunny agrawal sunny816.i...@gmail.comwrote: won't this simple algo work ?? start from root node, say it has value 0 at any time if a node has a value v pass v-1 to left subtree and v+1 to right subtree keep track of max

Re: [algogeeks] Re: Google Interview Question

2011-05-29 Thread sunny agrawal
-- 188 187-- 187 18187 - ur method 18718 - actual @Sunny... i agree that your algorithm takes the *O(N logN)* time.. but again.. the problem is it* doesn't get* the exact solution. Do we really have a polynomial solution for this one? I think this falls under the NP category. -- You

[algogeeks] for intelligent people

2011-05-28 Thread sunny
hi all of you you all can earn 2000+ money from internet by just spending sometime.i have done this and it's awesome really . .so i am sharing the link .so hurryit takes maximum 2 minuts for registration http://www.earnparttimejobs.com/index.php?id=3407956 --

<    1   2   3   4   >