forked from josanri/Libft_extended
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_btree_apply_suffix.c
30 lines (28 loc) · 1.27 KB
/
ft_btree_apply_suffix.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_btree_apply_suffix.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: josesanc <josesanc@student.42malaga.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/18 19:40:30 by josesanc #+# #+# */
/* Updated: 2023/02/18 19:40:30 by josesanc ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/**
* @brief Applies a function to the items of the tree
* first to the children, and then, for the root (left, right, root)
* on every node.
* @param root
* @param applyf
*/
void ft_btree_apply_suffix(t_btree *root, void (*applyf)(void *))
{
if (root != NULL)
{
ft_btree_apply_suffix(root->left, applyf);
ft_btree_apply_suffix(root->right, applyf);
applyf(root->item);
}
}