Files
42_INT_06_pushwap/srcs/algo.c
2021-06-14 11:22:45 +02:00

29 lines
517 B
C

#include "pushswap.h"
void hugo_sort(t_stack **a, t_list **solution)
{
sa(a, solution);
sa(a, solution);
sa(a, solution);
}
/*
** this function creates the stack b and the list solution
** then it calls the sorting algorithm
** then it frees everything that needs to be freed
*/
t_list *sort_algo(t_stack *a)
{
t_stack *b;
t_list *solution;
solution = NULL;
if(!(b = ft_calloc(1, sizeof(t_stack))))
ps_stop(a, b, NULL, 2);
hugo_sort(&a, &solution);
ps_stop(NULL, b, NULL, -1);
return (solution);
}