Is their any some one can help me say

step 1: I want to take a number n as input from user

step 2: We from the set S consisting of elements from 0 to n*(2^{n-1})

step 3: Now I pick have to all possible 2 element sets of S say from it and store it in "P"

step 4: Now i need to pick n*(2^{n-1}) 2 element sets from P such that each number that occurs in that set occurs exactly n times neither less nor more and put them all in a list

Example
n=2
n*(2^{n-1})=2*2^{2-1}=4
S={0,1,2,3,4}
p={(0,1),(0,2),(0,3),(0,4),(1,2),(1,3),(1,4),(2,3),(2,4),(3,4)}

step 4 one element which satieties condition of step 4 HERE n=2 {(0,1),(1,2),(2,3),(0,3)} which has 2* 2^{n-1}=2*2^{2-1}=4 elements

Now see in the above set 0 occurred n=2 times only in (0,1) and (0,3) only 1 occurred n=2 times only in (0,1) and (1,2) only 2 occurred n=2 times only in (1,2) and (2,3) only 3 occurred n=2 times only in (2,3) and (0,3) only

Similarly we may get for {(0,1),(1,4),(4,2),(2,0)} we can easily verify like above

Now based on n the number of elements size etc will vary

kind help if possible any one