-
Notifications
You must be signed in to change notification settings - Fork 1
/
push_swap.h
63 lines (58 loc) · 2.26 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
51
52
53
54
55
56
57
58
59
60
61
62
63
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_swap.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lburkins <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/31 13:16:40 by lburkins #+# #+# */
/* Updated: 2024/03/07 10:43:39 by lburkins ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef PUSH_SWAP_H
# define PUSH_SWAP_H
# include "libft/libft.h"
# include <stdlib.h>
# include <limits.h>
typedef struct s_node
{
int num;
int index;
int push_cost;
int above_median;
int cheapest;
struct s_node *target_node;
struct s_node *next;
struct s_node *prev;
} t_node;
int main(int argc, char *argv[]);
void create_a(int ac, char *av[], t_node **stack);
void check_valid(char **args, int split_flag);
void sort_stack(t_node **a, t_node **b);
void ra(t_node **a);
void rb(t_node **b);
void rr(t_node **a, t_node **b);
void rotate_both(t_node **a, t_node **b, t_node *cheapest);
void rra(t_node **a);
void rrb(t_node **b);
void rrr(t_node **a, t_node **b);
void rev_rotate_both(t_node **a, t_node **b, t_node *cheapest);
void sa(t_node **a);
void sb(t_node **b);
void pa(t_node **a, t_node **b);
void pb(t_node **b, t_node **a);
void error_n_exit(char **arguments, int split_flag);
void free_split(char **array);
void free_stack(t_node **stack);
t_node *find_last_node(t_node *lst);
int count_nodes(t_node *lst);
t_node *find_max(t_node *stack);
t_node *find_min(t_node *stack);
void init_nodes_a(t_node *a, t_node *b);
void current_index(t_node *stack);
void init_nodes_b(t_node *a, t_node *b);
void move_a_to_b(t_node **a, t_node **b);
void move_b_to_a(t_node **a, t_node **b);
void move_to_top(t_node **stack, t_node *top, char stack_name);
void put_min_ontop(t_node **stack);
#endif