diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-04-26 21:04:43 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-04-26 21:04:43 +0200 |
| commit | a3c962abbcdae671b886c4c76ddb9bb8ac27c958 (patch) | |
| tree | 7039b39f9fa56b9ad6e3b1c347fb5b77c049cada /src/bt/ft_btnew.c | |
| parent | 65c5d5157e890e9f9445a94fb2d7f660e5492d8e (diff) | |
| download | libft-a3c962abbcdae671b886c4c76ddb9bb8ac27c958.tar.gz libft-a3c962abbcdae671b886c4c76ddb9bb8ac27c958.tar.bz2 libft-a3c962abbcdae671b886c4c76ddb9bb8ac27c958.zip | |
Added ft_btsorted_insert, ft_btsorted_search, Red-black tree struct (not tested)
Diffstat (limited to 'src/bt/ft_btnew.c')
| -rw-r--r-- | src/bt/ft_btnew.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/bt/ft_btnew.c b/src/bt/ft_btnew.c index 973e1a4..09cfa12 100644 --- a/src/bt/ft_btnew.c +++ b/src/bt/ft_btnew.c @@ -6,20 +6,26 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/07 21:33:16 by cacharle #+# #+# */ -/* Updated: 2020/02/07 21:34:35 by cacharle ### ########.fr */ +/* Updated: 2020/04/26 19:46:57 by charles ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft_bt.h" -t_ftbtree *ft_btnew(void *data) +/* +** \brief Create a new binary tree +** \param data Node's data +** \return Allocated node with left and right set to NULL, NULL on error +*/ + +t_ftbt *ft_btnew(void *data) { - t_ftbtree *tree; + t_ftbt *tree; - if ((tree = (t_ftbtree*)malloc(sizeof(t_ftbtree))) == NULL) + if ((tree = (t_ftbt*)malloc(sizeof(t_ftbt))) == NULL) return (NULL); - tree->data = data; tree->left = NULL; tree->right = NULL; + tree->data = data; return (tree); } |
