Answer to Question #191417 in Algorithms for Basleen Kaur

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.


1
Expert's answer
2021-05-11T00:22:35-0400
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(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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS