intra to gitea
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* pushswap.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: lfirmin <[email protected]> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/12 18:06:41 by lfirmin #+# #+# */
|
||||
/* Updated: 2024/11/06 01:29:32 by lfirmin ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef PUSHSWAP_H
|
||||
# define PUSHSWAP_H
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* INCLUDES */
|
||||
/* ************************************************************************** */
|
||||
|
||||
# include <unistd.h>
|
||||
# include <stdlib.h>
|
||||
# include <limits.h>
|
||||
# include "../printf_fd/ftprintf.h"
|
||||
# include "../libft/libft.h"
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* STRUCTURES */
|
||||
/* ************************************************************************** */
|
||||
|
||||
typedef struct s_node
|
||||
{
|
||||
int value;
|
||||
struct s_node *next;
|
||||
} t_node;
|
||||
|
||||
typedef struct s_stack
|
||||
{
|
||||
t_node *top;
|
||||
int size;
|
||||
} t_stack;
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* STACK OPERATIONS */
|
||||
/* ************************************************************************** */
|
||||
|
||||
/* op.c */
|
||||
void add_stack(t_stack *stack, int value);
|
||||
int swap(t_stack *stack);
|
||||
int push(t_stack *stack_1, t_stack *stack_2);
|
||||
int rotate(t_stack *stack);
|
||||
int rrotate(t_stack *stack);
|
||||
|
||||
/* stack.c */
|
||||
void free_stack(t_stack *stack);
|
||||
t_stack *init_stack(void);
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* SORTING FUNCTIONS */
|
||||
/* ************************************************************************** */
|
||||
|
||||
/* sort_tiny.c */
|
||||
void sort_2(t_stack *stack_a);
|
||||
void sort_3(t_stack *stack_a);
|
||||
void sort_3_bis(t_node *v1, t_node *v2, t_node *v3, t_stack *stack_a);
|
||||
|
||||
/* sort.c */
|
||||
void sort(t_stack *stack_a, t_stack *stack_b);
|
||||
void final_sort(t_stack *stack_a);
|
||||
void opti_2(int *move);
|
||||
void opti(int *move);
|
||||
|
||||
/* sort_2.c */
|
||||
void make_move(t_stack *stack_a, t_stack *stack_b, int cheap_ind);
|
||||
int calc_move_stack_2(t_stack *stack, int index);
|
||||
void make_move_a(t_stack *stack_a, int move);
|
||||
void make_move_b(t_stack *stack_b, int move);
|
||||
void make_move_r(t_stack *stack_b, t_stack *stack_a, int move);
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* UTILITY FUNCTIONS */
|
||||
/* ************************************************************************** */
|
||||
|
||||
/* utils.c */
|
||||
t_node *go_to(t_node *top, int pos);
|
||||
int valid_input(const char *str);
|
||||
int in_stack(t_stack *stack, int n);
|
||||
int is_sorted(t_stack *stack);
|
||||
|
||||
/* sort_utils.c */
|
||||
int get_median(t_stack *stack, int size);
|
||||
void sort_int_table(int *tab, int size);
|
||||
int median_calc(int *tab, int size);
|
||||
|
||||
/* calc_cheaper_utils.c */
|
||||
int calc_index_min(t_stack *stack_a);
|
||||
int calc_index_max(t_stack *stack_a);
|
||||
int return_index(t_stack *stack, int value);
|
||||
int return_value(t_stack *stack, int index);
|
||||
int calc_index_a(t_stack *stack_a, int value);
|
||||
|
||||
/* calc_cheaper.c */
|
||||
int calc_cheaper(t_stack *stack_a, t_stack *stack_b);
|
||||
int calc_move(t_stack *stack_a, t_stack *stack_b, int index_b);
|
||||
int calc_move_stack(t_stack *stack, int index);
|
||||
|
||||
/* pars.c */
|
||||
char **pars(char **av);
|
||||
void free_array(char **array);
|
||||
char *init_empty_str(void);
|
||||
/* main.c */
|
||||
int main(int ac, char **av);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user