diff options
Diffstat (limited to 'src/multiset.h')
| -rw-r--r-- | src/multiset.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/multiset.h b/src/multiset.h new file mode 100644 index 0000000..6e1a8c9 --- /dev/null +++ b/src/multiset.h | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | #ifndef MULTISET_H | ||
| 2 | #define MULTISET_H | ||
| 3 | |||
| 4 | #include <stdlib.h> | ||
| 5 | #include <string.h> | ||
| 6 | #include "utils.h" | ||
| 7 | |||
| 8 | struct multiset_element | ||
| 9 | { | ||
| 10 | uint value; | ||
| 11 | uint count; | ||
| 12 | }; | ||
| 13 | |||
| 14 | typedef struct multiset | ||
| 15 | { | ||
| 16 | uint power; | ||
| 17 | struct multiset_element elements[0]; | ||
| 18 | } *MULTISET; | ||
| 19 | |||
| 20 | MULTISET init_multiset (uint power); | ||
| 21 | int compare_multiset_elements (const void *lhs, const void *rhs); | ||
| 22 | uint multiset_get (MULTISET ms, uint value); | ||
| 23 | MULTISET multiset_set (MULTISET ms, uint value, uint count); | ||
| 24 | uint multiset_element_max_count (MULTISET ms); | ||
| 25 | MULTISET multiset_copy (MULTISET ms); | ||
| 26 | MULTISET multiset_union (MULTISET lhs, MULTISET rhs); | ||
| 27 | MULTISET multiset_intersection (MULTISET lhs, MULTISET rhs); | ||
| 28 | MULTISET multiset_complement (MULTISET ms, MULTISET u); | ||
| 29 | MULTISET multiset_difference (MULTISET lhs, MULTISET rhs); | ||
| 30 | MULTISET multiset_arithmetic_sum (MULTISET lhs, MULTISET rhs, MULTISET u); | ||
| 31 | MULTISET multiset_arithmetic_difference (MULTISET lhs, MULTISET rhs); | ||
| 32 | MULTISET multiset_arithmetic_multiplication (MULTISET lhs, MULTISET rhs, MULTISET u); | ||
| 33 | MULTISET multiset_arithmetic_division (MULTISET lhs, MULTISET rhs, MULTISET u); | ||
| 34 | MULTISET multiset_symmetrical_difference (MULTISET lhs, MULTISET rhs); | ||
| 35 | |||
| 36 | #endif | ||
