summaryrefslogblamecommitdiff
path: root/sets.h
blob: 44114d108baed45441d5883808d74f3fcc47a1bf (plain) (tree)


























                                                          
                
                                 

                                             
 
                              



             
                  

















                                        
                                          








                                   

                           




      
/*
 * Projet d'Algorithmique et Programmation
 * Alex AUVOLAT, Mendes OULAMARA
 * 2013-2014
 * 
 * Sujet : Algorithme de Bron-Kerbosch pour Maximum-Clique
 * (cf maxclique.pdf)
 * */

#ifndef SET
#define SET
#include <stdbool.h>

#ifdef BITSETS
struct set{
    int N;
    unsigned long long* tab;
};

typedef struct set set;
#endif

#ifdef LINKEDLISTS
struct set_elt {
    int value;
    struct set_elt *next;
};
typedef struct {
    struct set_elt *first, *last;
	int size;	// number of elements
} t_set_descriptor;

typedef t_set_descriptor *set;
#endif

#ifdef TREAPS
// TODO
typedef void* set;
#endif


set empty_set(int size);
set singleton(int size, int x);
set copy_set(const set s);
void delete_set(set a);

void set_union_ip(set a, const set b); 
void set_inter_ip(set a, const set b);
void set_diff_ip(set a, const set b);

set set_union(const set a, const set b);
set set_inter(const set a, const set b);
set set_diff(const set a, const set b);

bool is_set_empty(const set s);
bool set_mem(int x, const set s);
bool sets_equal(const set a, const set b);

int elt_of_set(const set s);

set set_add(int x, const set s);
void set_add_ip(int x, set s);

set set_remove(int x, const set s);
void set_remove_ip(int x, set s);

void dump_set(const set s);

#endif