/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* btree_insert_data.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: gtertysh +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/11 19:17:19 by gtertysh #+# #+# */ /* Updated: 2016/11/11 21:21:32 by gtertysh ### ########.fr */ /* */ /* ************************************************************************** */ #include #include "ft_btree.h" void btree_insert_data(t_btree **root, void *item, int (*cmpf)(void *, void *)) { if (*root == NULL) { *root = btree_create_node(item); return ; } if (cmpf(item, (*root)->item) >= 0) btree_insert_data(&(*root)->right, item, cmpf); else if (cmpf(item, (*root)->item) < 0) btree_insert_data(&(*root)->left, item, cmpf); }