-
Notifications
You must be signed in to change notification settings - Fork 0
/
trie_count.c
executable file
·35 lines (32 loc) · 1.21 KB
/
trie_count.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
31
32
33
34
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* trie_count.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: akharrou <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/22 11:38:03 by akharrou #+# #+# */
/* Updated: 2019/03/04 13:17:20 by akharrou ### ########.fr */
/* */
/* ************************************************************************** */
#include "../Includes/trie.h"
unsigned int trie_count(t_trie *root)
{
unsigned int item_count;
unsigned int i;
if (root)
{
item_count = 0;
if (root->item)
item_count++;
i = 0;
while (i < SIZE_OF_ARRAY)
{
if (root->children[i])
item_count += trie_count(root->children[i]);
i++;
}
return (item_count);
}
return (0);
}