Treeset skeleton
This commit is contained in:
parent
f34dfcdccd
commit
b0d86c7e2c
4 changed files with 72 additions and 0 deletions
26
treeset/treeset.h
Normal file
26
treeset/treeset.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct treeset treeset_t;
|
||||
typedef struct treeset_node treeset_node_t;
|
||||
|
||||
/*
|
||||
* Cast a and b to your custom struct and return:
|
||||
* 1 for greater than
|
||||
* -1 for less than
|
||||
* 0 for equal
|
||||
*/
|
||||
int treeset_demo_cmp(void *a, void *b) {
|
||||
if (*((int *)a) > *((int *)a))
|
||||
return -1;
|
||||
if (*((int *)a) < *((int *)a))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void treeset_destroy(treeset_t *set);
|
||||
void put(treeset_t *set, void *data, int (*cmp)(void *, void *));
|
||||
// contains
|
||||
// remove
|
||||
Loading…
Add table
Add a link
Reference in a new issue