India’s Best Job Seekers and Training Platform Forums Data Structure Given a set of N numbers [1,N], partition them into 2 disjoint subsets..

  • Given a set of N numbers [1,N], partition them into 2 disjoint subsets..

     Akash  updated 11 months, 3 weeks ago 1 Member · 1 Post
  • Akash 

    Administrator
    at

    Given a set of N numbers [1,N], partition them into 2 disjoint subsets based on a set of K queries.

    Each query is of the type (n1, n2) where n1 and n2 are distinct numbers from the set and n1 and n2

    belong to opposite subsets.

    Example:

    Input:

    Input:

    N = 4

    K = [(1, 2), (1, 3), (2, 4)]

    Output:

    Set 1 : (1,4)

    Set 2 : (2,3)

Log in to reply.

Original Post
0 of 0 posts June 2018
Now
KodNest Training New Batch is starting on 02nd November 2020. Attend one week free demo classes.Register Now

New Report

Close