tgrekov-push_swap
HIVE push_swap July 2024
Loading...
Searching...
No Matches
stack.h File Reference

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* stack.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/06 04:03:43 by tgrekov #+# #+# */
/* Updated: 2024/07/16 12:25:05 by tgrekov ### ########.fr */
/* */
/* ************************************************************************** */

Definition in file stack.h.

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  s_stack
 

Functions

void push (t_stack *stack, int mode)
 Push the first element from stack 1 or 2 into the other stack, depending on whether mode is set to 0 or 1.
 
void r_rot (t_stack *stack, int mode)
 Shift all elements in stack 1, 2, or both up, depending on whether mode is set to 0, 1, or 2.
 
void rot (t_stack *stack, int mode)
 Shift all elements in stack 1, 2, or both down, depending on whether mode is set to 0, 1, or 2.
 
void swap (t_stack *stack, int mode)
 Swap the first two elements in stacks 1, 2, or both, depending on whether mode is set to 0, 1, or 2.
 
int is_sorted (t_stack *stack, int mode)
 Check if the contents of a stack are in the correct order relative to the smallest element.
 

Function Documentation

◆ is_sorted()

int is_sorted ( t_stack stack,
int  mode 
)

Check if the contents of a stack are in the correct order relative to the smallest element.

Parameters
[in]stack
[in]mode
Return values
int

Definition at line 31 of file is_sorted.c.

References get_minix().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ push()

void push ( t_stack stack,
int  mode 
)

Push the first element from stack 1 or 2 into the other stack, depending on whether mode is set to 0 or 1.

Parameters
[in,out]stack
[in]mode

Definition at line 55 of file push.c.

References _push(), and ft_printf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ r_rot()

void r_rot ( t_stack stack,
int  mode 
)

Shift all elements in stack 1, 2, or both up, depending on whether mode is set to 0, 1, or 2.

Parameters
[in,out]stack
[in]mode

Definition at line 51 of file r_rot.c.

References _r_rot(), and ft_printf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rot()

void rot ( t_stack stack,
int  mode 
)

Shift all elements in stack 1, 2, or both down, depending on whether mode is set to 0, 1, or 2.

Parameters
[in,out]stack
[in]mode

Definition at line 51 of file rot.c.

References _rot(), and ft_printf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ swap()

void swap ( t_stack stack,
int  mode 
)

Swap the first two elements in stacks 1, 2, or both, depending on whether mode is set to 0, 1, or 2.

Parameters
[in,out]stack
[in]mode

Definition at line 48 of file swap.c.

References _swap(), and ft_printf().

Here is the call graph for this function:
Here is the caller graph for this function: