aboutsummaryrefslogtreecommitdiff
path: root/src/multiset.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/multiset.h')
-rw-r--r--src/multiset.h36
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
8struct multiset_element
9{
10 uint value;
11 uint count;
12};
13
14typedef struct multiset
15{
16 uint power;
17 struct multiset_element elements[0];
18} *MULTISET;
19
20MULTISET init_multiset (uint power);
21int compare_multiset_elements (const void *lhs, const void *rhs);
22uint multiset_get (MULTISET ms, uint value);
23MULTISET multiset_set (MULTISET ms, uint value, uint count);
24uint multiset_element_max_count (MULTISET ms);
25MULTISET multiset_copy (MULTISET ms);
26MULTISET multiset_union (MULTISET lhs, MULTISET rhs);
27MULTISET multiset_intersection (MULTISET lhs, MULTISET rhs);
28MULTISET multiset_complement (MULTISET ms, MULTISET u);
29MULTISET multiset_difference (MULTISET lhs, MULTISET rhs);
30MULTISET multiset_arithmetic_sum (MULTISET lhs, MULTISET rhs, MULTISET u);
31MULTISET multiset_arithmetic_difference (MULTISET lhs, MULTISET rhs);
32MULTISET multiset_arithmetic_multiplication (MULTISET lhs, MULTISET rhs, MULTISET u);
33MULTISET multiset_arithmetic_division (MULTISET lhs, MULTISET rhs, MULTISET u);
34MULTISET multiset_symmetrical_difference (MULTISET lhs, MULTISET rhs);
35
36#endif