Multiple choice

Suppose each set is represented as a linked list with elements in arbitrary order. Which of the operations among union, intersection, membership, cardinality will be the slowest?

  1. union only

  2. intersection, membership

  3. membership, cardinality

  4. union, intersection

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Membership & cardinality functions takes constt. time i.e. 0(1), but union & intersection require emparison of 1 element with all the other elements so these two would be slowest.