aboutsummaryrefslogtreecommitdiff
path: root/src/lst/ft_lstsort.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lst/ft_lstsort.c')
-rw-r--r--src/lst/ft_lstsort.c40
1 files changed, 0 insertions, 40 deletions
diff --git a/src/lst/ft_lstsort.c b/src/lst/ft_lstsort.c
deleted file mode 100644
index e1c9913..0000000
--- a/src/lst/ft_lstsort.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* ************************************************************************** */
-/* */
-/* ::: :::::::: */
-/* ft_lstsort.c :+: :+: :+: */
-/* +:+ +:+ +:+ */
-/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
-/* +#+#+#+#+#+ +#+ */
-/* Created: 2020/02/10 01:53:55 by cacharle #+# #+# */
-/* Updated: 2020/02/16 02:18:05 by cacharle ### ########.fr */
-/* */
-/* ************************************************************************** */
-
-#include "libft_lst.h"
-
-void ft_lstsort(t_ftlst **begin_list, t_ftcompar_func cmp)
-{
- t_ftlst *fast;
- t_ftlst *slow;
- t_ftlst *middle;
-
- if (begin_list == NULL || *begin_list == NULL
- || (*begin_list)->next == NULL)
- return ;
- fast = (*begin_list)->next;
- slow = *begin_list;
- while (fast != NULL)
- {
- fast = fast->next;
- if (fast != NULL)
- {
- fast = fast->next;
- slow = slow->next;
- }
- }
- middle = slow->next;
- slow->next = NULL;
- ft_lstsort(begin_list, cmp);
- ft_lstsort(&middle, cmp);
- *begin_list = ft_lstsorted_merge(*begin_list, middle, cmp);
-}