[algogeeks] Re: find triangle in a graph

2009-09-13 Thread sirpi
On Sep 13, 7:27 pm, Dave wrote: > Suppose the graph consists of three nodes in a triangle. You number > your starting node at level 1 and the other two at level 2. How do you > proceed? If the three nodes are a triangle then in a *depth* search, there is node 1 and one of the neighbors is

[algogeeks] Re: max product of any three nos in an array of signed integers

2009-09-13 Thread sirpi
The problem could be generalized looking for the maximum product of more than three numbers. I think there is a domination relation so that if there is more than two number with the same sign that n and bigger absolute value you dominate n, in such a way the solution seems easy to get. --~--~--

[algogeeks] Re: what will happen in the village

2009-09-13 Thread sirpi
On Sep 13, 12:47 pm, SP Praveen wrote: >  given a village with demons and a sleeping man, The man is always > sleeping ,never wakes up. Now a demon can eat the sleeping man , but > after that he will fall asleep , any demon can eat another sleeping > demon. > >    If demons are very smart and w