Name

set_intersection

Synopsis

int set_intersection(Set *seti, const Set *set1, const Set *set2);

Return Value

0 if computing the intersection is successful, or -1 otherwise.

Description

Builds a set that is the intersection of set1 and set2. Upon return, seti contains the intersection. Because seti points to data in set1, the data in set1 must remain valid until seti is destroyed with set_destroy.

Complexity

O (mn), where m and n are the number of members in set1 and set2, respectively.

Get Mastering Algorithms with C now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.