|
Data Structures Lerax
v3.0-101-gb1f7
Opinionated Data Structures & Algorithms
|
#include <stddef.h>#include <stdbool.h>#include "../list/single/list.h"#include "../iterator/iterator.h"Go to the source code of this file.
Typedefs | |
| typedef struct Set | Set |
| A basic implementation of a Set. | |
Functions | |
| Set * | set_create () |
| Create a new set instance. | |
| Set * | set_init (int set_size,...) |
| Create a new set instance with elements. | |
| Set * | set_copy (Set *set) |
| Create a set as copy of another. | |
| void | set_add (Set *set, int element) |
| Put a value associated to a key. | |
| bool | set_subset (Set *set_a, Set *set_b) |
| Check if set A is a subset of set B. | |
| Set * | set_intersection (Set *set_a, Set *set_b) |
| Intersection of set A and B. | |
| 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. | |
| bool | set_equal (Set *set_a, Set *set_b) |
| Check if set A and B are equals. | |
| void | set_remove (Set *set, int element) |
| Remove a element. | |
| bool | set_contains (Set *set, int element) |
| Get a value in the set. | |
| void | set_print (Set *set) |
| Print all elements of the set. | |
| void | set_free (Set *set) |
| Free memory of set and its contents. | |
| Iterator * | set_iterator (Set *s) |
| Creates an iterator for the set. | |
| Set * | set_from_iterator (Iterator *s) |
| Creates a set from an iterator. | |
A basic implementation of a Set.
Copyrigset 2025 Manoel Vilela
Author: Manoel Vilela
Contact: manoel_vilela@engineer.com
Organization: ITA
This implementation uses a hash table to store the elements, which allows for efficient insertion, deletion, and membership testing.
Creates a set from an iterator.
| s | The iterator to create the set from. |