Home » Programming & Data Structure » Programming and data structure miscellaneous » Question

Programming and data structure miscellaneous

Programming & Data Structure

  1. 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
Correct Option: D

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



Your comments will be displayed only after manual approval.