Nearly there !!!

WIP merge sort
still problems with negative numbers
This commit is contained in:
Tanguy MAZE
2019-03-06 12:12:00 +01:00
parent ac9b03acff
commit 428525b561
6 changed files with 114 additions and 36 deletions

View File

@@ -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;
}
}