Question #191417

Suppose you are given n sets:S1,S2.....Sn each set is having n elements.the problems is to find whether some pairs of these sets are disjoint,i.e. there are no common elements in these sets.write pseudo code and calculate its time complexity.


Expert's answer

Start
Scan elements A[n], B[n]
for loop initiated i to n
  for loop initiated j to n
      if(A[i]==B[j])
        Set is not not a disjoint
      else 
        set is disjoint
stop

Time complexity of the code T(n)=O(n2)T(n)=O(n^2)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS