Algorithm firsts utils (stack size + check order)

This commit is contained in:
Maoake Teriierooiterai
2025-12-09 12:32:13 +01:00
parent 8cd29f7151
commit c9066f4a9b
2 changed files with 57 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* check_order.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mteriier <mteriier@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/12/09 11:57:06 by mteriier #+# #+# */
/* Updated: 2025/12/09 12:02:28 by mteriier ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
int check_order(t_stack *stack)
{
t_stack *first;
first = stack;
while (stack->next != first)
{
if (stack->value > stack->next->value)
return (0);
stack = stack->next;
}
return (0);
}