-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpush_swap.h
50 lines (45 loc) · 1.84 KB
/
push_swap.h
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
42
43
44
45
46
47
48
49
50
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_swap.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: togauthi <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/29 10:09:04 by togauthi #+# #+# */
/* Updated: 2024/12/06 11:14:15 by togauthi ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef PUSH_SWAP_H
# define PUSH_SWAP_H
# include "libft/libft.h"
# include "printf/ft_printf.h"
typedef struct s_element
{
int nbr;
int index;
struct s_element *next;
struct s_element *prev;
} t_element;
// 5 4 300
typedef struct s_stack
{
t_element *top;
} t_stack;
int check_args(int argc, char **argv);
void put_stack_end(t_stack *stack, t_element *element);
void free_stack(t_stack *stack);
void push(t_stack *original, t_stack *to_push, char *to_print);
void rotate(t_stack *stack, char *to_print);
void swap(t_stack *stack, char *to_print);
void reverse_rotate(t_stack *stack, char *to_print);
int stack_len(t_stack *stack);
t_element *stack_last(t_stack *stack);
int is_sorted(t_stack *stack);
void sort(t_stack *main, t_stack *tmp);
int give_max_byte(t_stack *stack);
int current_rank(t_stack *stack, int nbr);
int lower(t_stack *stack);
int bigger(t_stack *stack);
void sort_five(t_stack *main, t_stack *tmp);
void free_split(char **str);
#endif