1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#ifndef MULTISET_H
#define MULTISET_H
#include <stdlib.h>
#include <string.h>
#include "utils.h"
struct multiset_element
{
uint value;
uint count;
};
typedef struct multiset
{
uint power;
struct multiset_element elements[0];
} *MULTISET;
MULTISET init_multiset (uint power);
int compare_multiset_elements (const void *lhs, const void *rhs);
uint multiset_get (MULTISET ms, uint value);
MULTISET multiset_set (MULTISET ms, uint value, uint count);
uint multiset_element_max_count (MULTISET ms);
MULTISET multiset_copy (MULTISET ms);
MULTISET multiset_union (MULTISET lhs, MULTISET rhs);
MULTISET multiset_intersection (MULTISET lhs, MULTISET rhs);
MULTISET multiset_complement (MULTISET ms, MULTISET u);
MULTISET multiset_difference (MULTISET lhs, MULTISET rhs);
MULTISET multiset_arithmetic_sum (MULTISET lhs, MULTISET rhs, MULTISET u);
MULTISET multiset_arithmetic_difference (MULTISET lhs, MULTISET rhs);
MULTISET multiset_arithmetic_multiplication (MULTISET lhs, MULTISET rhs, MULTISET u);
MULTISET multiset_arithmetic_division (MULTISET lhs, MULTISET rhs, MULTISET u);
MULTISET multiset_symmetrical_difference (MULTISET lhs, MULTISET rhs);
#endif
|