aboutsummaryrefslogtreecommitdiff
path: root/libft/include/libft_algo.h
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-10-11 15:52:52 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-10-11 15:52:52 +0200
commitc98de126d2252fe47dc2a9094a5f9a8fa6b4b60a (patch)
tree12f1c827ee063ed3e7038f6a704014e611e4f388 /libft/include/libft_algo.h
parenta4ceb5974d1b7dcdd12cc81b7eb07893ea16c8ad (diff)
downloadminishell-c98de126d2252fe47dc2a9094a5f9a8fa6b4b60a.tar.gz
minishell-c98de126d2252fe47dc2a9094a5f9a8fa6b4b60a.tar.bz2
minishell-c98de126d2252fe47dc2a9094a5f9a8fa6b4b60a.zip
Removing libft/minishell_test submodules, Removing subject/README/etc
Diffstat (limited to 'libft/include/libft_algo.h')
-rw-r--r--libft/include/libft_algo.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/libft/include/libft_algo.h b/libft/include/libft_algo.h
new file mode 100644
index 0000000..e859de5
--- /dev/null
+++ b/libft/include/libft_algo.h
@@ -0,0 +1,81 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* libft_algo.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/01/19 07:22:57 by cacharle #+# #+# */
+/* Updated: 2020/04/04 23:33:51 by charles ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+/*
+** \file libft_algo.h
+** \brief Algorithms
+*/
+
+#ifndef LIBFT_ALGO_H
+# define LIBFT_ALGO_H
+
+# include <stdlib.h>
+# include "libft_mem.h"
+# include "libft_def.h"
+# include "libft_str.h"
+
+/*
+** \brief Range struct
+** \param lo Lower bound
+** \param hi Upper bound
+*/
+
+typedef struct
+{
+ int lo;
+ int hi;
+} t_ftrange;
+
+/*
+** \brief Merge sort consts struct
+** \param base Array to sort
+** \param left Left subarray
+** \param right Right subarray
+** \note Only used internaly by ft_mergesort
+*/
+
+struct s_merge_sorted_arrays
+{
+ void *base;
+ void *left;
+ void *right;
+};
+
+/*
+** remove this horror
+*/
+
+typedef struct s_ft_search_const
+{
+ const void *key;
+ t_ftcompar_func compar;
+} t_ftsearch_const;
+
+bool ft_is_set(void *base, size_t nel, size_t width,
+ t_ftcompar_func compar);
+int ft_compar_int(const void *a, const void *b);
+int ft_compar_str(const void *s1_p, const void *s2_p);
+void ft_qsort(void *base, size_t nel, size_t width,
+ t_ftcompar_func compar);
+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 *));
+void ft_reverse(void *base, size_t nel, size_t width);
+void *ft_bsearch(const void *base, size_t nel, size_t width,
+ t_ftsearch_const *consts);
+void *ft_lfind(const void *base, size_t *nelp, size_t width,
+ t_ftsearch_const *consts);
+void *ft_lsearch(const void *base, size_t *nelp, size_t width,
+ t_ftsearch_const *consts);
+
+#endif