aboutsummaryrefslogtreecommitdiff
path: root/c13/ex03
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-07-24 08:02:55 +0200
committerCharles <sircharlesaze@gmail.com>2019-07-24 08:02:55 +0200
commit5bab06313e71e9827baa426a02bbaf2a00b4e6a0 (patch)
tree5604e51c0008088f25b2f5dfb9143a852dd079dd /c13/ex03
parent23ad79e8b41c25bb4992d103d29a17612a52e351 (diff)
downloadpiscine-5bab06313e71e9827baa426a02bbaf2a00b4e6a0.tar.gz
piscine-5bab06313e71e9827baa426a02bbaf2a00b4e6a0.tar.bz2
piscine-5bab06313e71e9827baa426a02bbaf2a00b4e6a0.zip
c12 passed, c13 start
Diffstat (limited to 'c13/ex03')
-rw-r--r--c13/ex03/btree_apply_suffix.c22
-rw-r--r--c13/ex03/ft_btree.h23
2 files changed, 45 insertions, 0 deletions
diff --git a/c13/ex03/btree_apply_suffix.c b/c13/ex03/btree_apply_suffix.c
index e69de29..6d5c3b2 100644
--- a/c13/ex03/btree_apply_suffix.c
+++ b/c13/ex03/btree_apply_suffix.c
@@ -0,0 +1,22 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* btree_apply_suffix.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/21 18:37:33 by cacharle #+# #+# */
+/* Updated: 2019/07/21 18:38:10 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "ft_btree.h"
+
+void btree_apply_suffix(t_btree *root, void (*applyf)(void *))
+{
+ if (root == NULL)
+ return ;
+ btree_apply_suffix(root->left);
+ btree_apply_suffix(root->right);
+ (*applyf)(root->item);
+}
diff --git a/c13/ex03/ft_btree.h b/c13/ex03/ft_btree.h
new file mode 100644
index 0000000..3af177e
--- /dev/null
+++ b/c13/ex03/ft_btree.h
@@ -0,0 +1,23 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_btree.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* 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