Is there any methods in C standard libraries making the same thing with union() or difference() methods in Python? I have googled some, but find nothing.
Any help will be appreciated.
Thanks.
Is there any methods in C standard libraries making the same thing with union() or difference() methods in Python? I have googled some, but find nothing.
Any help will be appreciated.
Thanks.
The C standard libraries do not implement set operators (as stated in response to this prior SO question). This prior SO question suggests pblset
as an alternative, and I'm sure there are others, but that's not a direct answer to your question (the direct answer is "no"). This SO question addresses array comparisons using a hash table. In that same vein, responses to this SO question explain how to implement intersection using hashes.
Take a look at the hash table in klib
, a C-based library. You could think about how you might mimic a set of elements with the keys of a hash table, and how you could implement set operations once you have hash tables built for each set.