Represent the dependencies as a graph. Store all the values in a list. For
each vertex in the graph find all values for which there is no edge from
the vertex. If these values are there in the list, remove them from the
list and create a set of the vertex and the removed values.
If the values are not there in the list then create a set with the vertex
only. Do this for all the vertices.

On Mon, Oct 31, 2011 at 5:51 PM, Bharath 2009503507 CSE <
bharathgo...@gmail.com> wrote:

> Given a set of values..in which there are some dependencies..
>
> Eg..  x y z a b
>
> Dependencies: x,y
> a,z
>
> Note that dependency is not transitive..Is it possible to separate
> these elements into sets such that no two elements in the same set are
> dependant and we should end up with the least number of sets..
>
> I could not find a good solution for this..Please help me..
>
> Regards,
>
> Bharathwajan
>
> --
> 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 options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to