mirror of
https://github.com/DavidGailleton/42-Push_Swap.git
synced 2026-01-27 00:41:57 +00:00
bubble algorithm WIP
This commit is contained in:
23
algorithms/bubble/bubble.c
Normal file
23
algorithms/bubble/bubble.c
Normal file
@@ -0,0 +1,23 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* bubble.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: mteriier <mteriier@student.42lyon.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/12/09 11:56:23 by mteriier #+# #+# */
|
||||
/* Updated: 2025/12/09 12:43:09 by mteriier ### ########lyon.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "push_swap.h"
|
||||
|
||||
void bubble_alg(t_stacks *stacks)
|
||||
{
|
||||
while (!check_order(stacks->a))
|
||||
{
|
||||
if (stacks->a->value > stacks->a->next->value)
|
||||
sa(stacks);
|
||||
ra(stacks);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user