diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-08-02 11:05:33 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-08-02 11:05:33 +0200 |
| commit | 5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde (patch) | |
| tree | 80911dc3c32e9f230750e7e1042d413dfb6efab2 /include/libft_bt.h | |
| parent | ee32953ea79616e72f5428cdf40c834714a891c9 (diff) | |
| parent | b96b82194ccad2cddbb46b77aa1962a57c47ff44 (diff) | |
| download | libft-5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde.tar.gz libft-5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde.tar.bz2 libft-5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde.zip | |
Merge branch 'master' into ft_ssl
Diffstat (limited to 'include/libft_bt.h')
| -rw-r--r-- | include/libft_bt.h | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/include/libft_bt.h b/include/libft_bt.h index 6e2cc91..7bd7eb4 100644 --- a/include/libft_bt.h +++ b/include/libft_bt.h @@ -6,23 +6,44 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/07 21:26:34 by cacharle #+# #+# */ -/* Updated: 2020/02/07 21:34:52 by cacharle ### ########.fr */ +/* Updated: 2020/04/26 19:45:56 by charles ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef LIBFT_BT_H # define LIBFT_BT_H +/* +** \file libft_bt.h +** \brief Binary tree +*/ + # include <stdlib.h> -typedef struct s_ftbtree +/* +** \brief Binary tree struct +** \param left Left node +** \param right Right node +** \param data Node data +*/ + +typedef struct s_ftbt { - void *data; - struct s_ftbtree *left; - struct s_ftbtree *right; -} t_ftbtree; + struct s_ftbt *left; + struct s_ftbt *right; + void *data; +} t_ftbt; + +t_ftbt *ft_btnew(void *data); +void ft_btdestroy(t_ftbt *tree, void (*del)(void *data)); -t_ftbtree *ft_btnew(void *data); -void ft_btdestroy(t_ftbtree *tree, void (*del)(void *data)); +t_ftbt *ft_btsorted_insert( + t_ftbt *tree, + void *data, + int (*cmp)(void*, void*)); +void *ft_btsorted_search( + t_ftbt *tree, + void *ref, + int (*cmp)(void*, void*)); #endif |
