Nearly there !!!
WIP merge sort still problems with negative numbers
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/02/21 14:06:40 by tmaze #+# #+# */
|
||||
/* Updated: 2019/03/02 15:34:54 by tmaze ### ########.fr */
|
||||
/* Updated: 2019/03/06 12:02:03 by tmaze ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -14,23 +14,24 @@
|
||||
|
||||
void ps_swap(t_psdata *data, char c)
|
||||
{
|
||||
t_stack *s;
|
||||
t_stack **s;
|
||||
size_t size;
|
||||
int tmp;
|
||||
t_stack *tmp;
|
||||
|
||||
if (c == 'a')
|
||||
s = data->a;
|
||||
s = &(data->a);
|
||||
if (c == 'a')
|
||||
size = data->size_a;
|
||||
else if (c == 'b')
|
||||
s = data->b;
|
||||
s = &(data->b);
|
||||
if (c == 'b')
|
||||
size = data->size_b;
|
||||
if (s != NULL && size >= 2)
|
||||
{
|
||||
tmp = s->nb;
|
||||
s->nb = s->next->nb;
|
||||
s->next->nb = tmp;
|
||||
tmp = *s;
|
||||
*s = (*s)->next;
|
||||
tmp->next = (*s)->next;
|
||||
(*s)->next = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user