C Everything
This is a C repository containing a curated set of generic data structures and algorithm.
disjoint_set.h
Go to the documentation of this file.
1 
5 #pragma once
6 #include "common.h"
7 
9 typedef struct t_djset_node {
10  int size;
11  int parent;
13 
15 typedef int (*f_set1)(t_gen, int);
16 typedef int (*f_set2)(t_gen, int, int);
17 
19 typedef struct disjoint_set {
20  char *name;
21  int size;
23 
27 
31 
32 t_gen create_disjoint_set(char *name, int size);
Top level include containg common headers.
int(* f_set1)(t_gen, int)
Disjoint set operations func pointers.
Definition: disjoint_set.h:15
t_gen create_disjoint_set(char *name, int size)
Create an instance of disjoint set data struct
Definition: disjoint_set.c:20
struct t_djset_node t_dsetnode
Disjoint set node definition.
int(* f_set2)(t_gen, int, int)
Definition: disjoint_set.h:16
struct disjoint_set t_disjset
Disjoint set main struct definition.
Disjoint set main struct definition.
Definition: disjoint_set.h:19
f_print print
routine to print elements in the disjoint set
Definition: disjoint_set.h:28
int size
Max size of elems stored in disjoint set.
Definition: disjoint_set.h:21
f_set2 merge
routine to merge to set
Definition: disjoint_set.h:26
char * name
Name of link list instance *‍/.
Definition: disjoint_set.h:20
f_destroy destroy
routine to destroy the instace of disjoint set
Definition: disjoint_set.h:29
t_dsetnode * subset
Pointer to N sets.
Definition: disjoint_set.h:22
f_set1 find
routine to find an elem in the set
Definition: disjoint_set.h:25
f_vgen make
routine to add an new elem to the set
Definition: disjoint_set.h:24
Disjoint set node definition.
Definition: disjoint_set.h:9
int size
size of the current set
Definition: disjoint_set.h:10
int parent
Parent idx of the set.
Definition: disjoint_set.h:11
void(* f_vgen)(t_gen)
fn ptr that takes one gen ptr and return nothing
Definition: typedefs.h:49
f_vgen f_print
fn type to print function
Definition: typedefs.h:56
f_vgen f_destroy
fn type of destroy function
Definition: typedefs.h:61
void * t_gen
Base Data type used for all data structure and data elements.
Definition: typedefs.h:41