Re: [algogeeks] Re: Printing all inversions in an array

2012-10-23 Thread Dipit Grover
^ Exactly! Dipit Grover B.Tech in Computer Science and Engineering - lVth year IIT Roorkee, 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

Re: [algogeeks] Printing all inversions in an array

2012-10-22 Thread Dipit Grover
Since the number of inversions are of order n^2 in the worst case, so should be the complexity of printing them apparently. -- 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

Re: [algogeeks] Codeforces Problem

2012-08-15 Thread Dipit Grover
Hi, you just need to see the figure carefully and derive a simple formula here. The tiles are all regular hexagons and The figure shown is for the given sample case where a=2,b=3,c=4, thereby implying that each side of the hexagonal tile(say, x) satisfies : x*(cos 30) = 1/2; Thanks Digo --

Re: [algogeeks] [Offtopic] Wedding Invitation

2012-02-29 Thread Dipit Grover
http://yeees.com/ -- 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] Maximize XOR

2012-02-23 Thread Dipit Grover
http://discuss.joelonsoftware.com/default.asp?interview.11.614716 -- 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

Re: [algogeeks] Re : GAMECOIN

2012-01-23 Thread Dipit Grover
] . So the second term would mean (1-dp[i-3])*1/2 * 1/2 * 1/2 . Now the probability that Dave wins for any 'i' would be (1-dp[i]). -- Dipit Grover B.Tech in Computer Science and Engineering - lllrd year IIT Roorkee, India -- You received this message because you are subscribed to the Google

Re: [algogeeks] sort 2D array

2012-01-11 Thread Dipit Grover
@Lucifer : I came up with a similar algorithm as yours but I dont understand your complexity analysis : sum over all i (1 to M} { i*(M+N-i) } . Shouldnt it be M * sum over all i(1 to N) {(M+N-i)} ? M= no of columns, N= no of rows . Since we always have the min element at the 0th column of

Re: [algogeeks] Re: sort 2D array

2012-01-11 Thread Dipit Grover
@ all k-way people : I dont get it how the complexity would be O(m*n) . I just went through the algo and I feel that one would need to find the minimum element among the head-elements of all individual row-arrays, for all the resulting m*n elements. I say so since we may not necessarily have a

Re: [algogeeks] Re: sort 2D array

2012-01-11 Thread Dipit Grover
@Shady : you would definitely need two index variables for each array I feel. -- 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

Re: [algogeeks] Re: sort 2D array

2012-01-11 Thread Dipit Grover
sorry I mean 1 variable per each array -- 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

Re: [algogeeks] Re: Find Largest number in log(n)

2011-12-12 Thread Dipit Grover
^it cant get better than O(n) apparently. Just applying max-heapify once would not yield the max element. You need to construct a heap for it, which is no less than O(n). -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

Re: [algogeeks] Re: Best algorithm possible

2011-12-12 Thread Dipit Grover
@Lucifer (Regarding your latest approach) - I guess you meant string based comparison sort in the first step, as in 9 would be greater than 10. The special case seems correct but I doubt the complexity being nlog n, considering the special case. -- You received this message because you are

Re: [algogeeks] No of triangles

2011-12-04 Thread Dipit Grover
http://susam.in/downloads/mathematics/theorems/integer-triangles-with-fixed-perimeter.pdf -- Dipit Grover B.Tech in Computer Science and Engineering - lllrd year IIT Roorkee, India -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] NUMBER OF MST ?

2011-12-03 Thread Dipit Grover
Shouldnt it be (n!)/2 ? Equivalent to permutation of n distinct numbers except that we need to count each permutation once, since for any permutation, there would also be a reverse permutation that would result in an identical mst in the given scenario. -- Dipit Grover B.Tech in Computer

Re: [algogeeks] NUMBER OF MST ?

2011-12-03 Thread Dipit Grover
^ we need to count each permutation and its reverse together as one possibility since both would result in identical mst. -- Dipit Grover B.Tech in Computer Science and Engineering - lllrd year IIT Roorkee, India -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] NUMBER OF MST ?

2011-12-03 Thread Dipit Grover
Mistake noted! Haste makes waste indeed. -- 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.

Re: [algogeeks] NUMBER OF MST ?

2011-12-03 Thread Dipit Grover
http://en.wikipedia.org/wiki/Cayley%27s_formula -- 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

Re: [algogeeks] Finding the indexes of a repeated element??

2011-11-08 Thread Dipit Grover
Using binary search, first find the first occurrence of x. Using this first occurrence run another binary search to find the last occurrence of x. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks] Modular arithmetic + Combinatorics

2011-11-02 Thread Dipit Grover
Hi everyone, I am stuck at places where I need to find lets say Binomial_coefficient(1000,10) mod 1000 000 007 . What is the best way to do this, assuming we donot have sufficient memory to use the naive approach : (n,r) = (n-1,r) + (n-1,r-1) . -- Dipit Grover B.Tech in Computer Science

Re: [algogeeks] Re: Modular arithmetic + Combinatorics

2011-11-02 Thread Dipit Grover
Thats really cool! Thanks Dave :) -- 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] Re: Amazon online test

2011-09-24 Thread dipit grover
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. -- Dipit

Re: [algogeeks]

2011-08-27 Thread dipit grover
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. -- Dipit Grover

Re: [algogeeks]

2011-08-27 Thread dipit grover
/amolsharma99http://in.linkedin.com/pub/amol-sharma/21/79b/507http://youtube.com/amolsharma99 On Sat, Aug 27, 2011 at 3:13 PM, dipit grover digo.d.b...@gmail.comwrote: http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Re: Problem on overflow

2011-08-27 Thread dipit grover
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. -- Dipit Grover B.Tech in CSE IIT Roorkee -- You received this message because you

Re: [algogeeks] Re: Problem on overflow

2011-08-27 Thread dipit grover
Oops, I just saw that Dave had already corrected it. Net problem, sorry guys! On Sat, Aug 27, 2011 at 11:02 PM, dipit grover digo.d.b...@gmail.comwrote: I think you just need to reverse the comparison operators in Dave's earlier post On Sat, Aug 27, 2011 at 10:59 PM, Dave dave_and_da