Find the minimum spanning tree. Find the nodes with indegree of 1 and mark
the node which connects to that node with indgree 1.
On Wed, Oct 7, 2009 at 11:08 PM, Ramaswamy R ramaswam...@gmail.com wrote:
We have to find the minimum cardinality out of all possible bi-partite sets
of the graph.
LOL search for dominance in graph.
2009/10/7 ankur aggarwal ankur.mast@gmail.com
Given a graph..
Find the minimum number of coloring (Marking) required to node such that
every node in the final graph is connected by at least one of the
colored(marked) node.
ex:
AB
AC
BD
BE
CF
2. Given an array all of whose elements are positive numbers, find the
maximum sum of a subsequence with the constraint that no 2 numbers in the
sequence should be adjacent in the array.
i) 3 2 7 10 should return 13 (sum of 3 and 10)
ii) 3 2 5 10 7 should return 15 (sum of 3, 5 and 7)
How to find the intersection point in linked list with the following
constraints
1) one traversal for each of the lists
2) should not find the LENGTH of the lists
3) can USE recursion It goes like this ...
--~--~-~--~~~---~--~~
You received this message because you
How will you implement infinite memory(infinite strings) in finite space
Propose some method...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
You are standing at a crossing from where there emerge four roads extending
to infinity. Your friend is somewhere on one of the four roads. You do not
know on which road he is and how far he is from you. You have to walk to
your friend and the total distance traveled by you must be at most a
hash one list and wen u traverse other check if prest in hash
On Fri, Oct 9, 2009 at 10:02 AM, ankur aggarwal ankur.mast@gmail.comwrote:
How to find the intersection point in linked list with the following
constraints
1) one traversal for each of the lists
2) should not find the LENGTH
This is a simple dp problem .
define for each i following 2 quantities :
best1[i] : best sum in similar constraint of first i elements only when last
( ith ) term is always included
best2[i] : best sum in similar constraint of the first i elements only when
last (ith ) term is NOT included
so we
#includeiostream
using namespace std;
int maxsum(int a[], int n)
{
int prevmaxsum=0;
int currmaxsum=a[0];
int last=0,temp=0;
for(int i=1;in;i++)
{
if(last!=(i-1))
{
prevmaxsum=currmaxsum;
currmaxsum=a[i]+prevmaxsum;
last=i;
On Oct 9, 8:56 am, ankur aggarwal ankur.mast@gmail.com wrote:
2. Given an array all of whose elements are positive numbers, find the
maximum sum of a subsequence with the constraint that no 2 numbers in the
sequence should be adjacent in the array.
i) 3 2 7 10 should return 13 (sum of
@sharad
wat about space ??
extra space ?
--~--~-~--~~~---~--~~
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
it is NP hard problem i suppose..
On Fri, Oct 9, 2009 at 4:20 PM, Miroslav Balaz gpsla...@googlemail.comwrote:
LOL search for dominance in graph.
2009/10/7 ankur aggarwal ankur.mast@gmail.com
Given a graph..
Find the minimum number of coloring (Marking) required to node such that
space comp O(n)
time o(2n) both in terms of worst case
On Fri, Oct 9, 2009 at 8:46 PM, ankur aggarwal ankur.mast@gmail.comwrote:
@sharad
wat about space ??
extra space ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to
Wouldn't it be better to replace step 5 with
Travel 2^(n+1) distance on the fourth road. If you find your friend
DONE else
return back to the crossing
? After you have exhausted the first three roads to a distance 2^n,
there is no point to going only 2^n on the fourth road and then
returning
Anyway the solution is O(d) [:)] which is asked to be proved.
--~--~-~--~~~---~--~~
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
Here is one solution http://geeksforgeeks.org/?p=2405
On Fri, Oct 9, 2009 at 9:00 AM, sharad kumar aryansmit3...@gmail.comwrote:
space comp O(n)
time o(2n) both in terms of worst case
On Fri, Oct 9, 2009 at 8:46 PM, ankur aggarwal
ankur.mast@gmail.comwrote:
@sharad
wat about space
yes anil
your approach is rite..
--~--~-~--~~~---~--~~
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
Given 13 balls, how would you arrange them in 9 lines, such that there are 4
balls in each line? You can assume that the lines are arranged in 2-D space
and that a ball
cannot be placed on top of another ball.
Bonus: if you find that too easy, and have loads of time to kill, then how
about
u have to color n similar balls with k diff. colors , such that every
color must be used atleast once find the no. of ways
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this
example:
n=10,k=10
ans:1
n=30,k=7
ans:
475020
On Oct 10, 9:51 am, vicky mehta...@gmail.com wrote:
u have to color n similar balls with k diff. colors , such that every
color must be used atleast once find the no. of ways
--~--~-~--~~~---~--~~
You received this
Sterling numbers of second kind.
On Sat, Oct 10, 2009 at 10:41 AM, vicky mehta...@gmail.com wrote:
example:
n=10,k=10
ans:1
n=30,k=7
ans:
475020
On Oct 10, 9:51 am, vicky mehta...@gmail.com wrote:
u have to color n similar balls with k diff. colors , such that every
color must be
21 matches
Mail list logo