aboutsummaryrefslogtreecommitdiff
path: root/include/libft_bt.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libft_bt.h')
-rw-r--r--include/libft_bt.h37
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