This is like the TOPOLOGY SORT .

Repeat the steps until all the elements of orginal set is visited:-
Do
First need to add all those elements in a set whose inorder is Zero .
 Then create another set whose inorder is 1 , after making set 1 ,
then decrease the inorder by 1 for those elements who was connected to
the elements formed in set 1.
Done

On 10/31/11, teja bala <[email protected]> wrote:
> +1 abhishek
>
> On Mon, Oct 31, 2011 at 6:26 PM, abhishek kumar <[email protected]> wrote:
>
>> 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 <
>> [email protected]> 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 [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> 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 [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Somnath Singh

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to