special sort for 3 ok
This commit is contained in:
@@ -142,9 +142,11 @@ void recursif_sort(t_stack **a, t_stack **b, t_list *solution)
|
||||
void hugo_sort(t_stack **a, t_stack **b, t_list *solution)
|
||||
{
|
||||
if (sublist_size(*a) <= 3)
|
||||
special_sort_3(a, b, solution);
|
||||
special_sort_3(a, solution);
|
||||
/*
|
||||
else if (sublist_size(*a) <= 5)
|
||||
special_sort_5(a, b, solution);
|
||||
*/
|
||||
else
|
||||
recursif_sort(a, b, solution);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,35 @@
|
||||
#include "push_swap.h"
|
||||
|
||||
void special_sort_3(t_stack **a, t_stack **b, t_list *solution)
|
||||
void special_sort_3(t_stack **a, t_list *solution)
|
||||
{
|
||||
int order;
|
||||
int size;
|
||||
|
||||
size = sublist_size(*a);
|
||||
order = order_is(*a, size);
|
||||
if (order == 12)
|
||||
sa(a, &solution);
|
||||
if (order == 123)
|
||||
{
|
||||
ra(a, &solution);
|
||||
sa(a, &solution);
|
||||
}
|
||||
if (order == 132)
|
||||
rra(a, &solution);
|
||||
if (order == 213)
|
||||
ra(a, &solution);
|
||||
if (order == 231)
|
||||
{
|
||||
rra(a, &solution);
|
||||
sa(a, &solution);
|
||||
}
|
||||
if (order == 312)
|
||||
sa(a, &solution);
|
||||
}
|
||||
|
||||
/*
|
||||
void special_sort_5(t_stack **a, t_stack **b, t_list *solution)
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user