I have googled it but dint find explanation with an example.
here is the wiki link:
http://en.wikipedia.org/wiki/Hopcroft%E2%80%93Karp_algorithm
Thanks,
Prakash.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
2! - x=y=4
3! - x=y=12
4! - x=y=48
5! - x=y=240
6! - x=y=1440
I don't have proof to prove x = y always.
But if x=y, then the answer should be x=y=2*n!
On Mon, Jun 25, 2012 at 5:04 PM, Roshan kumar...@gmail.com wrote:
Few Months back I found the problem
on Code Sprint
1/x + 1/y = 1/N! (N
:
Sorry My Mistake *Number of pairs should be OUTPUT...*
On Mon, Jun 25, 2012 at 8:49 PM, prakash y yprakash@gmail.com wrote:
2! - x=y=4
3! - x=y=12
4! - x=y=48
5! - x=y=240
6! - x=y=1440
I don't have proof to prove x = y always.
But if x=y, then the answer should be x=y=2*n
How to implement complex data structures like trees (with unknown no.of
subtrees) and graphs efficiently in C/Java?
I have implemented binary trees in Java as it always contains two nodes.
But I don't know about graphs.
I am not able to solve these problems in coding contests because of this.
Can
:
you can use adjacency matrices for spare graphs and two dimensional
array for non-spare graphs
On Tue, May 29, 2012 at 2:47 PM, prakash y yprakash@gmail.comwrote:
How to implement complex data structures like trees (with unknown no.of
subtrees) and graphs efficiently in C/Java?
I have
@rahul, the voting algorithm may not give the majorty element in the array
if the majorty element occurs =n/2 times.
but the problem clearly says that majorty element that appears more than
n/2 times.
in such cases, the voting algo always gives the corret majorty element, if
exists.
On Sun, Mar
Hope this will work perfectly;
if(r n-r)
r = n - r;
int result = n;
for(int i=2; i=r; i++)
{
n--;
result *= n;
result /= i;
result %= p;
}
print result;
On Sat, Mar 3, 2012 at 9:42 PM, pankajsingh psingh...@gmail.com wrote:
@amrit- thnks!!
--
You received this message because you are
Hi guys,
I tried to participate in this contest and solved the first problem KDEBUG1
in Java. But I got time limit exceeded error.
I observed that most of the coders use C/C++, and I know that Java is
slower when compared to C/C++.
My algorithm might be inefficient. But before that I just want to
I think atul/Ramakanth's approach will work fine, if we include one more
condition
for each arr[i][j]
if(arr[i][j]==1)
{
if (arr[i-1][j]==0 arr[i][j-1]==0 arr[i-1][j-1]==0)
count++;
else if (arr[i-1][j]==1 arr[i][j-1]==1 arr[i-1][j-1]==0)
count--;
}
On Wed, Jan 11, 2012 at 8:10 AM, surender
sort the whole matrix in ascending array means?
can you please explain ?
On Wed, Jan 11, 2012 at 12:53 PM, atul anand atul.87fri...@gmail.comwrote:
Given 2D array.
The rows are sorted in ascending order and the colums are sorted in
ascending order.
We have to sort the whole matrix in
The number of distinct factors a number has is given by the product of one
more than the maximum power of each of the prime factors.
the number 24*33 = 792 can be written as (2^3)*(3^2)*(11^1)
then the number of distinct factors of 792 will become (3+1)*(2+1)*(1+1) =
24
So we can form 24/2 = 12
11 matches
Mail list logo