-
Notifications
You must be signed in to change notification settings - Fork 0
/
algorithm.c
31 lines (29 loc) · 1.26 KB
/
algorithm.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* algorithm.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: atoof <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/11 17:33:11 by atoof #+# #+# */
/* Updated: 2023/04/11 17:33:11 by atoof ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
void sort_stack(t_node **stack_a, t_node **stack_b, size_t size)
{
if (size == 2)
{
if (is_sorted(stack_a) != 1)
sa(stack_a);
return ;
}
else if (size == 3)
sort_three(stack_a);
else if (size == 4)
sort_four(stack_a, stack_b);
else if (size == 5)
sort_five(stack_a, stack_b);
else
sort_big_stack(stack_a, stack_b);
}