From bca75f071153ddcaa5ceee0722e2152bacfedc78 Mon Sep 17 00:00:00 2001 From: Comrade Martin Miroslavovich Michalec Date: Sat, 25 Nov 2023 19:24:10 +0300 Subject: publish --- src/multiset.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/multiset.h (limited to 'src/multiset.h') 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 @@ +#ifndef MULTISET_H +#define MULTISET_H + +#include +#include +#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 -- cgit v1.3.1