figure aa bba these algorithms most of the algorithms defined in system linq enumerable deal mainly with sequences rather than sets exclusively set union can be implemented as simple traversal of both sets adding each item of the two sets to new union set algorithm union(set set preset and set union is set posta union of set and set has been created foreach item in set union add(item end foreach foreach item in set union add(item end foreach return union end union the run time of our union algorithm is ( nwhere is the number of items in the first set and is the number of items in the second set this runtime applies only to sets that exhibit ( insertions set intersection is also trivial to implement the only major thing worth pointing out about our algorithm is that we traverse the set containing the fewest items we can do this because if we have exhausted all the items in the smaller of the two sets then there are no more items that are members of both setsthus we have no more items to add to the intersection set