Question: Given a list of sets, the task is to sort the sets such that subsets, appear before their supersets. Sets which aren't subsets of each
Given a list of sets, the task is to sort the sets such that subsets, appear before their supersets.
Sets which aren't subsets of each other have an undefined order, as long as the subset property is maintained.
The builtin sort routine allows passing a custom comparator to replace the default < operator. Which custom comparator function would accomplish this?
1. is superset: left.issuperset(right)
2. is subset: left.issubset(right)
3. is.disjoint: left.isdisjoint(right)
4. size: left.size < right.size
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
