-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
41 lines (38 loc) · 1.51 KB
/
main.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
32
33
34
35
36
37
38
39
40
41
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: akaratas <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/10 16:42:51 by akaratas #+# #+# */
/* Updated: 2024/03/20 15:34:21 by akaratas ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
int main(int argc, char **argv)
{
t_list *stack_a;
t_list *stack_b;
int stack_size;
if (argc >= 2)
{
stack_a = NULL;
stack_b = NULL;
create_stack(argc, argv, &stack_a);
flag_assign(stack_a);
if (is_sorted(stack_a, 0) == 1)
exit(0);
stack_size = ft_lstsize(stack_a);
if (stack_size == 2)
two_argument_sort(&stack_a, 0);
else if (stack_size == 3)
three_argument_sort(&stack_a, 0, 2);
else if (stack_size == 4)
four_argument_sort(&stack_a, &stack_b, 0, 3);
else if (stack_size == 5)
five_argument_sort(&stack_a, &stack_b);
else if (stack_size >= 6)
radix_sort(&stack_a, &stack_b);
}
}