From 5bab06313e71e9827baa426a02bbaf2a00b4e6a0 Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 24 Jul 2019 08:02:55 +0200 Subject: c12 passed, c13 start --- c13/ex02/btree_apply_infix.c | 22 ++++++++++++++++++++++ c13/ex02/ft_btree.h | 23 +++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 c13/ex02/ft_btree.h (limited to 'c13/ex02') diff --git a/c13/ex02/btree_apply_infix.c b/c13/ex02/btree_apply_infix.c index e69de29..3ff3278 100644 --- a/c13/ex02/btree_apply_infix.c +++ b/c13/ex02/btree_apply_infix.c @@ -0,0 +1,22 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* btree_apply_infix.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/21 18:28:07 by cacharle #+# #+# */ +/* Updated: 2019/07/23 21:09:53 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "ft_btree.h" + +void btree_apply_infix(t_btree *root, void (*applyf)(void *)) +{ + if (root == NULL) + return ; + btree_apply_infix(root->left); + (*applyf)(root->item); + btree_apply_infix(root->right); +} diff --git a/c13/ex02/ft_btree.h b/c13/ex02/ft_btree.h new file mode 100644 index 0000000..3af177e --- /dev/null +++ b/c13/ex02/ft_btree.h @@ -0,0 +1,23 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_btree.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/17 19:29:12 by cacharle #+# #+# */ +/* Updated: 2019/07/21 18:19:33 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef FT_BTREE_H +# define FT_BTREE_H + +typedef struct s_btree +{ + struct s_btree *left; + struct s_btree *right; + void *item; +} t_btree; + +#endif -- cgit