summaryrefslogblamecommitdiff
path: root/sets.c
blob: 92d646c4c90fc927e0399698e3ce9c3a30a56d22 (plain) (tree)
1
2
3
4
5
6
7
8



                                                         
 
                                                                                   

  


                 


































                                         
/*
	Projet d'algorithmique et programmation 2013-2014
	(cours de C.Matthieu et J.Stern)
	Alex AUVOLAT, Mendes OULAMARA

	Fonctions utiles pour toutes les implémenentations des ensembles d'entiers
*/


#include "sets.h"

set singleton(int n, int x) {
	set k = empty_set(n);
	set_add_ip(x, k);
	return k;
}

set set_union(const set a, const set b) {
	set q = copy_set(a);
	set_union_ip(q, b);
	return q;
}

set set_inter(const set a, const set b) {
	set q = copy_set(a);
	set_inter_ip(q, b);
	return q;
}

set set_diff(const set a, const set b) {
	set q = copy_set(a);
	set_diff_ip(q, b);
	return q;
}

set set_add(int x, const set s) {
	set q = copy_set(s);
	set_add_ip(x, q);
	return q;
}

set set_remove(int x, const set s) {
	set q = copy_set(s);
	set_remove_ip(x, q);
	return q;
}