forked from AingeruAlvarezSanchez/Libft
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathft_btree_size.c
27 lines (25 loc) · 1.12 KB
/
ft_btree_size.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_btree_size.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: josesanc <josesanc@student.42malaga.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/18 19:40:18 by josesanc #+# #+# */
/* Updated: 2023/02/18 19:40:18 by josesanc ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/**
* @brief Returns the size of nodes at the tree
*
* @param root
* @return int
*/
int ft_btree_size(t_btree *root)
{
if (root == NULL)
return (0);
else
return (1 + ft_btree_size(root->left) + ft_btree_size(root->right));
}