This repository was archived by the owner on Oct 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpush_swap.h
67 lines (62 loc) · 2.24 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
64
65
66
67
/* ************************************************************************** */
/* */
/* :::::::: */
/* push_swap.h :+: :+: */
/* +:+ */
/* By: fbes <fbes@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2021/06/10 17:40:10 by fbes #+# #+# */
/* Updated: 2021/11/01 20:58:27 by fbes ######## odam.nl */
/* */
/* ************************************************************************** */
#ifndef PUSH_SWAP_H
# define PUSH_SWAP_H
typedef struct s_link
{
int num;
int id;
struct s_link *prev;
struct s_link *next;
} t_link;
typedef struct s_stack
{
char id;
int size;
t_link *top;
} t_stack;
int only_spaces(const char *s);
t_stack *new_stack(char id);
void free_stack(t_stack *s);
void print_stack(t_stack *s);
void debug_stack(t_stack *s);
void index_stack(t_stack *s);
t_link *get_stack_link(t_stack *s, int index);
t_link *get_stack_bottom(t_stack *s);
t_link *get_stack_biggest(t_stack *s);
t_link *get_stack_smallest(t_stack *s);
int get_min_steps_to_reach(t_stack *s, t_link *f);
int parse_num(t_stack *a, int *n, char *s);
int push(t_stack *s, t_link *link, int n);
void push_smallest_to_b(t_stack *a, t_stack *b);
t_link *pop(t_stack *s);
void swap(t_stack *s);
void rotate(t_stack *s);
void reverse(t_stack *s);
void pa(t_stack *a, t_stack *b);
void pb(t_stack *a, t_stack *b);
void pf(t_stack *a, t_stack *b);
void sa(t_stack *a);
void sb(t_stack *b);
void sf(t_stack *b);
void ss(t_stack *a, t_stack *b);
void ra(t_stack *a);
void rb(t_stack *b);
void rf(t_stack *b);
void rr(t_stack *a, t_stack *b);
void rra(t_stack *a);
void rrb(t_stack *b);
void rrf(t_stack *b);
void rrr(t_stack *a, t_stack *b);
int sort(t_stack *a, t_stack *b);
int is_sorted(t_stack *s, int dir);
#endif