Data Structures Lerax  v3.0-102-gaf18
Opinionated Data Structures & Algorithms
Loading...
Searching...
No Matches
set.h
Go to the documentation of this file.
1
12
13#ifndef SET_H
14#define SET_H
15
16#include <stddef.h>
17#include <stdbool.h>
18#include "../list/single/list.h"
20
27typedef struct Set Set;
28
35
42Set* set_init(int set_size, ...);
43
51
58void set_add(Set *set, int element);
59
66bool set_subset(Set *set_a, Set *set_b);
67
74Set* set_intersection(Set *set_a, Set *set_b);
75
82Set* set_union(Set *set_a, Set *set_b);
83
90Set* set_difference(Set *set_a, Set *set_b);
91
99bool set_equal(Set *set_a, Set *set_b);
100
107void set_remove(Set *set, int element);
108
115bool set_contains(Set *set, int element);
116
122void set_print(Set *set);
123
129void set_free(Set *set);
130
138
139
147
148#endif /* SET_H */
void set_remove(Set *set, int element)
Remove a element.
Set * set_union(Set *set_a, Set *set_b)
Union of set A and B.
Set * set_difference(Set *set_a, Set *set_b)
Difference of set A and B.
Set * set_create()
Create a new set instance.
Set * set_copy(Set *set)
Create a set as copy of another.
bool set_contains(Set *set, int element)
Get a value in the set.
Set * set_init(int set_size,...)
Create a new set instance with elements.
bool set_subset(Set *set_a, Set *set_b)
Check if set A is a subset of set B.
void set_print(Set *set)
Print all elements of the set.
Set * set_intersection(Set *set_a, Set *set_b)
Intersection of set A and B.
void set_add(Set *set, int element)
Put a value associated to a key.
void set_free(Set *set)
Free memory of set and its contents.
bool set_equal(Set *set_a, Set *set_b)
Check if set A and B are equals.
Set * set_from_iterator(Iterator *s)
Creates a set from an iterator.
Iterator * set_iterator(Set *s)
Creates an iterator for the set.
struct Set Set
A basic implementation of a Set.
Definition set.h:27
A generic iterator struct.
Definition iterator.h:13