algorithm with no double nodes and nearly efficient enough still some optimizations to find for --big-superposition maps
30 lines
1.2 KiB
C
30 lines
1.2 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_lstaddend.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2018/04/17 20:55:26 by tmaze #+# #+# */
|
|
/* Updated: 2018/11/26 12:30:30 by tmaze ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
|
|
t_list *ft_lstaddend(t_list **alst, t_list *new)
|
|
{
|
|
t_list *tmp;
|
|
|
|
if (new == NULL)
|
|
return (NULL);
|
|
if (ft_lstsize(*alst) == 0)
|
|
ft_lstadd(alst, new);
|
|
else if (ft_lstsize(*alst) > 0)
|
|
{
|
|
tmp = ft_lstgetlast(*alst);
|
|
ft_lstadd(&(tmp->next), new);
|
|
}
|
|
return (*alst);
|
|
}
|