aboutsummaryrefslogtreecommitdiff
path: root/include/libft_algo.h
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-02-10 03:58:29 +0100
committerCharles <sircharlesaze@gmail.com>2020-02-10 03:58:29 +0100
commit4800d3ca472058f0161970aa55c6debb453e5d00 (patch)
treedefbbeb8484769322c93c0898a9d6dac15a4598a /include/libft_algo.h
parent48f43e34e9beafbc76a85c6f6874aae051981c72 (diff)
downloadlibft-4800d3ca472058f0161970aa55c6debb453e5d00.tar.gz
libft-4800d3ca472058f0161970aa55c6debb453e5d00.tar.bz2
libft-4800d3ca472058f0161970aa55c6debb453e5d00.zip
Fixing merge compilation error, Added ft_mergesort
Diffstat (limited to 'include/libft_algo.h')
-rw-r--r--include/libft_algo.h32
1 files changed, 23 insertions, 9 deletions
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 <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 <stdlib.h>
+# include <stddef.h>
+# 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