From 4800d3ca472058f0161970aa55c6debb453e5d00 Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 10 Feb 2020 03:58:29 +0100 Subject: Fixing merge compilation error, Added ft_mergesort --- include/libft_algo.h | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'include/libft_algo.h') diff --git a/include/libft_algo.h b/include/libft_algo.h index 4dc3353..14496dd 100644 --- a/include/libft_algo.h +++ b/include/libft_algo.h @@ -6,27 +6,41 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/19 07:22:57 by cacharle #+# #+# */ -/* Updated: 2020/02/10 02:21:47 by cacharle ### ########.fr */ +/* Updated: 2020/02/10 03:04:17 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef LIBFT_ALGO_H # define LIBFT_ALGO_H -typedef int t_bool; +# include +# include +# include "libft_mem.h" +# include "libft_types.h" typedef struct { - int lo; - int hi; -} t_ftrange; + int lo; + int hi; +} t_ftrange; -typedef int (*t_ftcompar_func)(const void*, const void*); +struct s_merge_sorted_arrays +{ + void *base; + void *left; + void *right; +}; + +typedef int (*t_ftcompar_func)(const void*, const void*); -t_bool ft_is_set(void *base, size_t nel, size_t width, +t_ftbool ft_is_set(void *base, size_t nel, size_t width, t_ftcompar_func compar); -void ft_qsort(void *base, size_t nel, size_t width, +int ft_compar_int(const void *a, const void *b); +void ft_qsort(void *base, size_t nel, size_t width, t_ftcompar_func compar); -int ft_compar_int(const void *a, const void *b); +int ft_mergesort(void *base, size_t nel, size_t width, + int (*compar)(const void *, const void *)); +int ft_heapsort(void *base, size_t nel, size_t width, + int (*compar)(const void *, const void *)); #endif -- cgit