├── author ├── libft ├── author ├── .DS_Store ├── ._author ├── ._libft.a ├── ._libft.h ├── ft_atoi.o ├── ft_itoa.o ├── ft_swap.o ├── libft.a ├── ._.DS_Store ├── ._Makefile ├── ._ft_atoi.c ├── ._ft_atoi.o ├── ._ft_itoa.c ├── ._ft_itoa.o ├── ._ft_swap.c ├── ._ft_swap.o ├── ft_bzero.o ├── ft_lstadd.o ├── ft_lstdel.o ├── ft_lstmap.o ├── ft_lstnew.o ├── ft_memchr.o ├── ft_memcmp.o ├── ft_memcpy.o ├── ft_memdel.o ├── ft_memset.o ├── ft_numlen.o ├── ft_putnbr.o ├── ft_putstr.o ├── ft_strcat.o ├── ft_strchr.o ├── ft_strclr.o ├── ft_strcmp.o ├── ft_strcpy.o ├── ft_strdel.o ├── ft_strdup.o ├── ft_strequ.o ├── ft_strlen.o ├── ft_strmap.o ├── ft_strnew.o ├── ft_strrev.o ├── ft_strstr.o ├── ft_strsub.o ├── libft.h.gch ├── ._ft_bzero.c ├── ._ft_bzero.o ├── ._ft_isalnum.c ├── ._ft_isalnum.o ├── ._ft_isalpha.c ├── ._ft_isalpha.o ├── ._ft_isascii.c ├── ._ft_isascii.o ├── ._ft_isdigit.c ├── ._ft_isdigit.o ├── ._ft_isprint.c ├── ._ft_isprint.o ├── ._ft_lstadd.c ├── ._ft_lstadd.o ├── ._ft_lstdel.c ├── ._ft_lstdel.o ├── ._ft_lstiter.c ├── ._ft_lstiter.o ├── ._ft_lstmap.c ├── ._ft_lstmap.o ├── ._ft_lstnew.c ├── ._ft_lstnew.o ├── ._ft_memccpy.c ├── ._ft_memccpy.o ├── ._ft_memchr.c ├── ._ft_memchr.o ├── ._ft_memcmp.c ├── ._ft_memcmp.o ├── ._ft_memcpy.c ├── ._ft_memcpy.o ├── ._ft_memdel.c ├── ._ft_memdel.o ├── ._ft_memmove.c ├── ._ft_memmove.o ├── ._ft_memset.c ├── ._ft_memset.o ├── ._ft_numlen.c ├── ._ft_numlen.o ├── ._ft_putchar.c ├── ._ft_putchar.o ├── ._ft_putendl.c ├── ._ft_putendl.o ├── ._ft_putnbr.c ├── ._ft_putnbr.o ├── ._ft_putstr.c ├── ._ft_putstr.o ├── ._ft_strcat.c ├── ._ft_strcat.o ├── ._ft_strchr.c ├── ._ft_strchr.o ├── ._ft_strclr.c ├── ._ft_strclr.o ├── ._ft_strcmp.c ├── ._ft_strcmp.o ├── ._ft_strcpy.c ├── ._ft_strcpy.o ├── ._ft_strdel.c ├── ._ft_strdel.o ├── ._ft_strdup.c ├── ._ft_strdup.o ├── ._ft_strequ.c ├── ._ft_strequ.o ├── ._ft_striter.c ├── ._ft_striter.o ├── ._ft_strjoin.c ├── ._ft_strjoin.o ├── ._ft_strlcat.c ├── ._ft_strlcat.o ├── ._ft_strlen.c ├── ._ft_strlen.o ├── ._ft_strmap.c ├── ._ft_strmap.o ├── ._ft_strmapi.c ├── ._ft_strmapi.o ├── ._ft_strncat.c ├── ._ft_strncat.o ├── ._ft_strncmp.c ├── ._ft_strncmp.o ├── ._ft_strncpy.c ├── ._ft_strncpy.o ├── ._ft_strnequ.c ├── ._ft_strnequ.o ├── ._ft_strnew.c ├── ._ft_strnew.o ├── ._ft_strnstr.c ├── ._ft_strnstr.o ├── ._ft_strrchr.c ├── ._ft_strrchr.o ├── ._ft_strrev.c ├── ._ft_strrev.o ├── ._ft_strstr.c ├── ._ft_strstr.o ├── ._ft_strsub.c ├── ._ft_strsub.o ├── ._ft_strtrim.c ├── ._ft_strtrim.o ├── ._ft_tolower.c ├── ._ft_tolower.o ├── ._ft_toupper.c ├── ._ft_toupper.o ├── ._libft.h.gch ├── ft_is_prime.o ├── ft_isalnum.o ├── ft_isalpha.o ├── ft_isascii.o ├── ft_isdigit.o ├── ft_isprint.o ├── ft_lstdelone.o ├── ft_lstiter.o ├── ft_memalloc.o ├── ft_memccpy.o ├── ft_memmove.o ├── ft_putchar.o ├── ft_putendl.o ├── ft_putnbr_fd.o ├── ft_putstr_fd.o ├── ft_striter.o ├── ft_striteri.o ├── ft_strjoin.o ├── ft_strlcat.o ├── ft_strmapi.o ├── ft_strncat.o ├── ft_strncmp.o ├── ft_strncpy.o ├── ft_strnequ.o ├── ft_strnstr.o ├── ft_strrchr.o ├── ft_strsplit.o ├── ft_strtrim.o ├── ft_tolower.o ├── ft_toupper.o ├── ._ft_is_prime.c ├── ._ft_is_prime.o ├── ._ft_lstdelone.c ├── ._ft_lstdelone.o ├── ._ft_memalloc.c ├── ._ft_memalloc.o ├── ._ft_putnbr_fd.c ├── ._ft_putnbr_fd.o ├── ._ft_putstr_fd.c ├── ._ft_putstr_fd.o ├── ._ft_striteri.c ├── ._ft_striteri.o ├── ._ft_strsplit.c ├── ._ft_strsplit.o ├── ft_count_words.o ├── ft_putchar_fd.o ├── ft_putendl_fd.o ├── ._ft_count_words.c ├── ._ft_count_words.o ├── ._ft_putchar_fd.c ├── ._ft_putchar_fd.o ├── ._ft_putendl_fd.c ├── ._ft_putendl_fd.o ├── ft_putchar.c ├── ft_strdel.c ├── ft_putchar_fd.c ├── ft_strnew.c ├── ft_isascii.c ├── ft_isdigit.c ├── ft_isprint.c ├── ft_memdel.c ├── ft_swap.c ├── ft_putendl.c ├── ft_isalpha.c ├── ft_strlen.c ├── ft_tolower.c ├── ft_toupper.c ├── ft_isalnum.c ├── ft_bzero.c ├── ft_putendl_fd.c ├── ft_strclr.c ├── ft_lstadd.c ├── ft_strequ.c ├── ft_striter.c ├── ft_lstiter.c ├── ft_putstr.c ├── ft_strnequ.c ├── ft_strcmp.c ├── ft_memalloc.c ├── ft_strchr.c ├── ft_lstdelone.c ├── ft_striteri.c ├── ft_strcpy.c ├── ft_strrchr.c ├── ft_lstmap.c ├── ft_strcat.c ├── ft_putstr_fd.c ├── ft_memchr.c ├── ft_numlen.c ├── ft_strncmp.c ├── ft_putnbr.c ├── ft_memset.c ├── ft_strrev.c ├── ft_lstdel.c ├── ft_strdup.c ├── ft_putnbr_fd.c ├── ft_strncat.c ├── ft_is_prime.c ├── ft_memmove.c ├── ft_count_words.c ├── ft_strncpy.c ├── ft_memcmp.c ├── ft_memcpy.c ├── ft_strsub.c ├── ft_strmapi.c ├── ft_strnstr.c ├── ft_strstr.c ├── ft_strlcat.c ├── ft_memccpy.c ├── ft_strmap.c ├── ft_itoa.c ├── ft_lstnew.c ├── ft_strjoin.c ├── ft_atoi.c ├── ft_strtrim.c ├── ft_strsplit.c ├── Makefile └── libft.h ├── checker ├── push_swap ├── gnl ├── .DS_Store ├── ._get_next_line.c ├── ._get_next_line.h ├── get_next_line.h └── get_next_line.c ├── push_swap.dSYM └── Contents │ ├── Resources │ └── DWARF │ │ └── push_swap │ └── Info.plist ├── README.md ├── rr.c ├── ss.c ├── rrr.c ├── tot_b.c ├── range.c ├── pa.c ├── pb.c ├── min_finder.c ├── sa.c ├── sb.c ├── biggest_finder.c ├── smallest_finder.c ├── first_confirmed_ordered.c ├── free_here.c ├── ra.c ├── rb.c ├── final_confirmed_ordered.c ├── rra.c ├── rrb.c ├── str_n_file.c ├── sort_three.c ├── b_helper_functs.c ├── helper_ra_rra.c ├── sort_three_solutions.c ├── my_insert_sort.c ├── checker.c ├── find_command.c ├── grab_command.c ├── send_entire_b_to_a.c ├── alg_file.c ├── jumbo_list.c ├── bulky_large.c ├── bulky_med.c ├── is_b_ordered.c ├── sort_five.c ├── Makefile ├── confirming_digits.c ├── push_swap.c └── check_header.h /author: -------------------------------------------------------------------------------- 1 | jadawson 2 | -------------------------------------------------------------------------------- /libft/author: -------------------------------------------------------------------------------- 1 | jadawson 2 | -------------------------------------------------------------------------------- /checker: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/checker -------------------------------------------------------------------------------- /push_swap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/push_swap -------------------------------------------------------------------------------- /gnl/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/gnl/.DS_Store -------------------------------------------------------------------------------- /libft/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/.DS_Store -------------------------------------------------------------------------------- /libft/._author: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._author -------------------------------------------------------------------------------- /libft/._libft.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._libft.a -------------------------------------------------------------------------------- /libft/._libft.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._libft.h -------------------------------------------------------------------------------- /libft/ft_atoi.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_atoi.o -------------------------------------------------------------------------------- /libft/ft_itoa.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_itoa.o -------------------------------------------------------------------------------- /libft/ft_swap.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_swap.o -------------------------------------------------------------------------------- /libft/libft.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/libft.a -------------------------------------------------------------------------------- /libft/._.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._.DS_Store -------------------------------------------------------------------------------- /libft/._Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._Makefile -------------------------------------------------------------------------------- /libft/._ft_atoi.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_atoi.c -------------------------------------------------------------------------------- /libft/._ft_atoi.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_atoi.o -------------------------------------------------------------------------------- /libft/._ft_itoa.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_itoa.c -------------------------------------------------------------------------------- /libft/._ft_itoa.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_itoa.o -------------------------------------------------------------------------------- /libft/._ft_swap.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_swap.c -------------------------------------------------------------------------------- /libft/._ft_swap.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_swap.o -------------------------------------------------------------------------------- /libft/ft_bzero.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_bzero.o -------------------------------------------------------------------------------- /libft/ft_lstadd.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_lstadd.o -------------------------------------------------------------------------------- /libft/ft_lstdel.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_lstdel.o -------------------------------------------------------------------------------- /libft/ft_lstmap.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_lstmap.o -------------------------------------------------------------------------------- /libft/ft_lstnew.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_lstnew.o -------------------------------------------------------------------------------- /libft/ft_memchr.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_memchr.o -------------------------------------------------------------------------------- /libft/ft_memcmp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_memcmp.o -------------------------------------------------------------------------------- /libft/ft_memcpy.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_memcpy.o -------------------------------------------------------------------------------- /libft/ft_memdel.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_memdel.o -------------------------------------------------------------------------------- /libft/ft_memset.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_memset.o -------------------------------------------------------------------------------- /libft/ft_numlen.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_numlen.o -------------------------------------------------------------------------------- /libft/ft_putnbr.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_putnbr.o -------------------------------------------------------------------------------- /libft/ft_putstr.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_putstr.o -------------------------------------------------------------------------------- /libft/ft_strcat.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strcat.o -------------------------------------------------------------------------------- /libft/ft_strchr.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strchr.o -------------------------------------------------------------------------------- /libft/ft_strclr.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strclr.o -------------------------------------------------------------------------------- /libft/ft_strcmp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strcmp.o -------------------------------------------------------------------------------- /libft/ft_strcpy.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strcpy.o -------------------------------------------------------------------------------- /libft/ft_strdel.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strdel.o -------------------------------------------------------------------------------- /libft/ft_strdup.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strdup.o -------------------------------------------------------------------------------- /libft/ft_strequ.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strequ.o -------------------------------------------------------------------------------- /libft/ft_strlen.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strlen.o -------------------------------------------------------------------------------- /libft/ft_strmap.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strmap.o -------------------------------------------------------------------------------- /libft/ft_strnew.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strnew.o -------------------------------------------------------------------------------- /libft/ft_strrev.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strrev.o -------------------------------------------------------------------------------- /libft/ft_strstr.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strstr.o -------------------------------------------------------------------------------- /libft/ft_strsub.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strsub.o -------------------------------------------------------------------------------- /libft/libft.h.gch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/libft.h.gch -------------------------------------------------------------------------------- /libft/._ft_bzero.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_bzero.c -------------------------------------------------------------------------------- /libft/._ft_bzero.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_bzero.o -------------------------------------------------------------------------------- /libft/._ft_isalnum.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_isalnum.c -------------------------------------------------------------------------------- /libft/._ft_isalnum.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_isalnum.o -------------------------------------------------------------------------------- /libft/._ft_isalpha.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_isalpha.c -------------------------------------------------------------------------------- /libft/._ft_isalpha.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_isalpha.o -------------------------------------------------------------------------------- /libft/._ft_isascii.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_isascii.c -------------------------------------------------------------------------------- /libft/._ft_isascii.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_isascii.o -------------------------------------------------------------------------------- /libft/._ft_isdigit.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_isdigit.c -------------------------------------------------------------------------------- /libft/._ft_isdigit.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_isdigit.o -------------------------------------------------------------------------------- /libft/._ft_isprint.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_isprint.c -------------------------------------------------------------------------------- /libft/._ft_isprint.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_isprint.o -------------------------------------------------------------------------------- /libft/._ft_lstadd.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_lstadd.c -------------------------------------------------------------------------------- /libft/._ft_lstadd.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_lstadd.o -------------------------------------------------------------------------------- /libft/._ft_lstdel.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_lstdel.c -------------------------------------------------------------------------------- /libft/._ft_lstdel.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_lstdel.o -------------------------------------------------------------------------------- /libft/._ft_lstiter.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_lstiter.c -------------------------------------------------------------------------------- /libft/._ft_lstiter.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_lstiter.o -------------------------------------------------------------------------------- /libft/._ft_lstmap.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_lstmap.c -------------------------------------------------------------------------------- /libft/._ft_lstmap.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_lstmap.o -------------------------------------------------------------------------------- /libft/._ft_lstnew.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_lstnew.c -------------------------------------------------------------------------------- /libft/._ft_lstnew.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_lstnew.o -------------------------------------------------------------------------------- /libft/._ft_memccpy.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_memccpy.c -------------------------------------------------------------------------------- /libft/._ft_memccpy.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_memccpy.o -------------------------------------------------------------------------------- /libft/._ft_memchr.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_memchr.c -------------------------------------------------------------------------------- /libft/._ft_memchr.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_memchr.o -------------------------------------------------------------------------------- /libft/._ft_memcmp.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_memcmp.c -------------------------------------------------------------------------------- /libft/._ft_memcmp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_memcmp.o -------------------------------------------------------------------------------- /libft/._ft_memcpy.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_memcpy.c -------------------------------------------------------------------------------- /libft/._ft_memcpy.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_memcpy.o -------------------------------------------------------------------------------- /libft/._ft_memdel.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_memdel.c -------------------------------------------------------------------------------- /libft/._ft_memdel.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_memdel.o -------------------------------------------------------------------------------- /libft/._ft_memmove.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_memmove.c -------------------------------------------------------------------------------- /libft/._ft_memmove.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_memmove.o -------------------------------------------------------------------------------- /libft/._ft_memset.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_memset.c -------------------------------------------------------------------------------- /libft/._ft_memset.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_memset.o -------------------------------------------------------------------------------- /libft/._ft_numlen.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_numlen.c -------------------------------------------------------------------------------- /libft/._ft_numlen.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_numlen.o -------------------------------------------------------------------------------- /libft/._ft_putchar.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_putchar.c -------------------------------------------------------------------------------- /libft/._ft_putchar.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_putchar.o -------------------------------------------------------------------------------- /libft/._ft_putendl.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_putendl.c -------------------------------------------------------------------------------- /libft/._ft_putendl.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_putendl.o -------------------------------------------------------------------------------- /libft/._ft_putnbr.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_putnbr.c -------------------------------------------------------------------------------- /libft/._ft_putnbr.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_putnbr.o -------------------------------------------------------------------------------- /libft/._ft_putstr.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_putstr.c -------------------------------------------------------------------------------- /libft/._ft_putstr.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_putstr.o -------------------------------------------------------------------------------- /libft/._ft_strcat.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strcat.c -------------------------------------------------------------------------------- /libft/._ft_strcat.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strcat.o -------------------------------------------------------------------------------- /libft/._ft_strchr.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strchr.c -------------------------------------------------------------------------------- /libft/._ft_strchr.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strchr.o -------------------------------------------------------------------------------- /libft/._ft_strclr.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strclr.c -------------------------------------------------------------------------------- /libft/._ft_strclr.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strclr.o -------------------------------------------------------------------------------- /libft/._ft_strcmp.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strcmp.c -------------------------------------------------------------------------------- /libft/._ft_strcmp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strcmp.o -------------------------------------------------------------------------------- /libft/._ft_strcpy.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strcpy.c -------------------------------------------------------------------------------- /libft/._ft_strcpy.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strcpy.o -------------------------------------------------------------------------------- /libft/._ft_strdel.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strdel.c -------------------------------------------------------------------------------- /libft/._ft_strdel.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strdel.o -------------------------------------------------------------------------------- /libft/._ft_strdup.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strdup.c -------------------------------------------------------------------------------- /libft/._ft_strdup.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strdup.o -------------------------------------------------------------------------------- /libft/._ft_strequ.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strequ.c -------------------------------------------------------------------------------- /libft/._ft_strequ.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strequ.o -------------------------------------------------------------------------------- /libft/._ft_striter.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_striter.c -------------------------------------------------------------------------------- /libft/._ft_striter.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_striter.o -------------------------------------------------------------------------------- /libft/._ft_strjoin.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strjoin.c -------------------------------------------------------------------------------- /libft/._ft_strjoin.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strjoin.o -------------------------------------------------------------------------------- /libft/._ft_strlcat.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strlcat.c -------------------------------------------------------------------------------- /libft/._ft_strlcat.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strlcat.o -------------------------------------------------------------------------------- /libft/._ft_strlen.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strlen.c -------------------------------------------------------------------------------- /libft/._ft_strlen.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strlen.o -------------------------------------------------------------------------------- /libft/._ft_strmap.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strmap.c -------------------------------------------------------------------------------- /libft/._ft_strmap.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strmap.o -------------------------------------------------------------------------------- /libft/._ft_strmapi.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strmapi.c -------------------------------------------------------------------------------- /libft/._ft_strmapi.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strmapi.o -------------------------------------------------------------------------------- /libft/._ft_strncat.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strncat.c -------------------------------------------------------------------------------- /libft/._ft_strncat.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strncat.o -------------------------------------------------------------------------------- /libft/._ft_strncmp.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strncmp.c -------------------------------------------------------------------------------- /libft/._ft_strncmp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strncmp.o -------------------------------------------------------------------------------- /libft/._ft_strncpy.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strncpy.c -------------------------------------------------------------------------------- /libft/._ft_strncpy.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strncpy.o -------------------------------------------------------------------------------- /libft/._ft_strnequ.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strnequ.c -------------------------------------------------------------------------------- /libft/._ft_strnequ.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strnequ.o -------------------------------------------------------------------------------- /libft/._ft_strnew.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strnew.c -------------------------------------------------------------------------------- /libft/._ft_strnew.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strnew.o -------------------------------------------------------------------------------- /libft/._ft_strnstr.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strnstr.c -------------------------------------------------------------------------------- /libft/._ft_strnstr.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strnstr.o -------------------------------------------------------------------------------- /libft/._ft_strrchr.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strrchr.c -------------------------------------------------------------------------------- /libft/._ft_strrchr.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strrchr.o -------------------------------------------------------------------------------- /libft/._ft_strrev.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strrev.c -------------------------------------------------------------------------------- /libft/._ft_strrev.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strrev.o -------------------------------------------------------------------------------- /libft/._ft_strstr.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strstr.c -------------------------------------------------------------------------------- /libft/._ft_strstr.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strstr.o -------------------------------------------------------------------------------- /libft/._ft_strsub.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strsub.c -------------------------------------------------------------------------------- /libft/._ft_strsub.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strsub.o -------------------------------------------------------------------------------- /libft/._ft_strtrim.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strtrim.c -------------------------------------------------------------------------------- /libft/._ft_strtrim.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strtrim.o -------------------------------------------------------------------------------- /libft/._ft_tolower.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_tolower.c -------------------------------------------------------------------------------- /libft/._ft_tolower.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_tolower.o -------------------------------------------------------------------------------- /libft/._ft_toupper.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_toupper.c -------------------------------------------------------------------------------- /libft/._ft_toupper.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_toupper.o -------------------------------------------------------------------------------- /libft/._libft.h.gch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._libft.h.gch -------------------------------------------------------------------------------- /libft/ft_is_prime.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_is_prime.o -------------------------------------------------------------------------------- /libft/ft_isalnum.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_isalnum.o -------------------------------------------------------------------------------- /libft/ft_isalpha.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_isalpha.o -------------------------------------------------------------------------------- /libft/ft_isascii.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_isascii.o -------------------------------------------------------------------------------- /libft/ft_isdigit.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_isdigit.o -------------------------------------------------------------------------------- /libft/ft_isprint.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_isprint.o -------------------------------------------------------------------------------- /libft/ft_lstdelone.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_lstdelone.o -------------------------------------------------------------------------------- /libft/ft_lstiter.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_lstiter.o -------------------------------------------------------------------------------- /libft/ft_memalloc.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_memalloc.o -------------------------------------------------------------------------------- /libft/ft_memccpy.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_memccpy.o -------------------------------------------------------------------------------- /libft/ft_memmove.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_memmove.o -------------------------------------------------------------------------------- /libft/ft_putchar.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_putchar.o -------------------------------------------------------------------------------- /libft/ft_putendl.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_putendl.o -------------------------------------------------------------------------------- /libft/ft_putnbr_fd.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_putnbr_fd.o -------------------------------------------------------------------------------- /libft/ft_putstr_fd.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_putstr_fd.o -------------------------------------------------------------------------------- /libft/ft_striter.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_striter.o -------------------------------------------------------------------------------- /libft/ft_striteri.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_striteri.o -------------------------------------------------------------------------------- /libft/ft_strjoin.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strjoin.o -------------------------------------------------------------------------------- /libft/ft_strlcat.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strlcat.o -------------------------------------------------------------------------------- /libft/ft_strmapi.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strmapi.o -------------------------------------------------------------------------------- /libft/ft_strncat.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strncat.o -------------------------------------------------------------------------------- /libft/ft_strncmp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strncmp.o -------------------------------------------------------------------------------- /libft/ft_strncpy.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strncpy.o -------------------------------------------------------------------------------- /libft/ft_strnequ.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strnequ.o -------------------------------------------------------------------------------- /libft/ft_strnstr.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strnstr.o -------------------------------------------------------------------------------- /libft/ft_strrchr.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strrchr.o -------------------------------------------------------------------------------- /libft/ft_strsplit.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strsplit.o -------------------------------------------------------------------------------- /libft/ft_strtrim.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_strtrim.o -------------------------------------------------------------------------------- /libft/ft_tolower.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_tolower.o -------------------------------------------------------------------------------- /libft/ft_toupper.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_toupper.o -------------------------------------------------------------------------------- /gnl/._get_next_line.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/gnl/._get_next_line.c -------------------------------------------------------------------------------- /gnl/._get_next_line.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/gnl/._get_next_line.h -------------------------------------------------------------------------------- /libft/._ft_is_prime.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_is_prime.c -------------------------------------------------------------------------------- /libft/._ft_is_prime.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_is_prime.o -------------------------------------------------------------------------------- /libft/._ft_lstdelone.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_lstdelone.c -------------------------------------------------------------------------------- /libft/._ft_lstdelone.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_lstdelone.o -------------------------------------------------------------------------------- /libft/._ft_memalloc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_memalloc.c -------------------------------------------------------------------------------- /libft/._ft_memalloc.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_memalloc.o -------------------------------------------------------------------------------- /libft/._ft_putnbr_fd.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_putnbr_fd.c -------------------------------------------------------------------------------- /libft/._ft_putnbr_fd.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_putnbr_fd.o -------------------------------------------------------------------------------- /libft/._ft_putstr_fd.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_putstr_fd.c -------------------------------------------------------------------------------- /libft/._ft_putstr_fd.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_putstr_fd.o -------------------------------------------------------------------------------- /libft/._ft_striteri.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_striteri.c -------------------------------------------------------------------------------- /libft/._ft_striteri.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_striteri.o -------------------------------------------------------------------------------- /libft/._ft_strsplit.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strsplit.c -------------------------------------------------------------------------------- /libft/._ft_strsplit.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_strsplit.o -------------------------------------------------------------------------------- /libft/ft_count_words.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_count_words.o -------------------------------------------------------------------------------- /libft/ft_putchar_fd.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_putchar_fd.o -------------------------------------------------------------------------------- /libft/ft_putendl_fd.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/ft_putendl_fd.o -------------------------------------------------------------------------------- /libft/._ft_count_words.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_count_words.c -------------------------------------------------------------------------------- /libft/._ft_count_words.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_count_words.o -------------------------------------------------------------------------------- /libft/._ft_putchar_fd.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_putchar_fd.c -------------------------------------------------------------------------------- /libft/._ft_putchar_fd.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_putchar_fd.o -------------------------------------------------------------------------------- /libft/._ft_putendl_fd.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_putendl_fd.c -------------------------------------------------------------------------------- /libft/._ft_putendl_fd.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/libft/._ft_putendl_fd.o -------------------------------------------------------------------------------- /push_swap.dSYM/Contents/Resources/DWARF/push_swap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamieDawson/push_swap_final/HEAD/push_swap.dSYM/Contents/Resources/DWARF/push_swap -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Push Swap is an algorithms project I completed at [42 Silicon Valley](https://www.42.us.org/).
2 | 3 | The idea of the project is that you have two stacks which are called Stack A and Stack B. Stack A can contain 1000+ random numbers. You have to sort Stack A from smallest to largest using only a handful of allowed moves. 4 | 5 | I used a optomized version of [Insertion Sort](https://en.wikipedia.org/wiki/Insertion_sort) in order to get the stack sorted. 6 | 7 | If you're interested in seeing my logic step by step, then you can [click here to see my Medium article that goes into every detail on how this project works.](https://medium.com/@jamierobertdawson/push-swap-the-least-amount-of-moves-with-two-stacks-d1e76a71789a) 8 | -------------------------------------------------------------------------------- /push_swap.dSYM/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleIdentifier 8 | com.apple.xcode.dsym.push_swap 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundlePackageType 12 | dSYM 13 | CFBundleSignature 14 | ???? 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleVersion 18 | 1 19 | 20 | 21 | -------------------------------------------------------------------------------- /libft/ft_putchar.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putchar.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 21:07:32 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/04 00:26:55 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putchar(char c) 16 | { 17 | write(1, &c, 1); 18 | } 19 | -------------------------------------------------------------------------------- /libft/ft_strdel.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strdel.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 21:01:45 by jadawson #+# #+# */ 9 | /* Updated: 2018/02/20 20:07:17 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_strdel(char **as) 16 | { 17 | ft_memdel((void **)as); 18 | } 19 | -------------------------------------------------------------------------------- /libft/ft_putchar_fd.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putchar_fd.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/20 13:45:12 by jadawson #+# #+# */ 9 | /* Updated: 2018/02/20 16:25:40 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putchar_fd(char c, int fd) 16 | { 17 | write(fd, &c, 1); 18 | } 19 | -------------------------------------------------------------------------------- /rr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* rr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/08/30 19:00:47 by jadawson #+# #+# */ 9 | /* Updated: 2018/09/10 00:58:23 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | void rr(t_nums **a, t_nums **b) 16 | { 17 | rotate_a(a); 18 | rotate_b(b); 19 | } 20 | -------------------------------------------------------------------------------- /ss.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ss.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/08/27 20:34:21 by jadawson #+# #+# */ 9 | /* Updated: 2018/10/16 16:09:35 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | void ss(t_nums **a, t_nums **b) 16 | { 17 | swap_a(a); 18 | swap_b(b); 19 | } 20 | -------------------------------------------------------------------------------- /libft/ft_strnew.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strnew.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 21:00:30 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/08 19:32:24 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strnew(size_t size) 16 | { 17 | return ((char *)ft_memalloc(size + 1)); 18 | } 19 | -------------------------------------------------------------------------------- /rrr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* rrr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/08/30 21:49:55 by jadawson #+# #+# */ 9 | /* Updated: 2018/09/07 16:46:52 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | void rrr(t_nums **a, t_nums **b) 16 | { 17 | reverse_rotate_a(a); 18 | reverse_rotate_b(b); 19 | } 20 | -------------------------------------------------------------------------------- /libft/ft_isascii.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isascii.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 20:22:28 by jadawson #+# #+# */ 9 | /* Updated: 2018/02/20 20:05:26 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_isascii(int c) 16 | { 17 | if (c >= 0 && c <= 127) 18 | return (1); 19 | return (0); 20 | } 21 | -------------------------------------------------------------------------------- /libft/ft_isdigit.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isdigit.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 20:18:13 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/10 18:14:27 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_isdigit(int c) 16 | { 17 | if (c >= '0' && c <= '9') 18 | return (1); 19 | return (0); 20 | } 21 | -------------------------------------------------------------------------------- /libft/ft_isprint.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isprint.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 20:51:37 by jadawson #+# #+# */ 9 | /* Updated: 2018/02/20 20:05:50 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_isprint(int c) 16 | { 17 | if (c >= 32 && c <= 126) 18 | return (1); 19 | return (0); 20 | } 21 | -------------------------------------------------------------------------------- /libft/ft_memdel.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memdel.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 20:59:19 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/03 16:54:24 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_memdel(void **ap) 16 | { 17 | if (ap) 18 | { 19 | free(*ap); 20 | *ap = NULL; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /libft/ft_swap.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_swap.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/03/10 20:07:30 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/10 20:17:09 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_swap(int *a, int *b) 16 | { 17 | int temp; 18 | 19 | temp = *a; 20 | *a = *b; 21 | *b = temp; 22 | } 23 | -------------------------------------------------------------------------------- /libft/ft_putendl.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putendl.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/20 13:40:44 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/06 23:55:54 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putendl(char *s) 16 | { 17 | if (!s) 18 | return ; 19 | ft_putstr(s); 20 | write(1, "\n", 1); 21 | } 22 | -------------------------------------------------------------------------------- /libft/ft_isalpha.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isalpha.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/20 15:54:06 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/05 00:37:05 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_isalpha(int c) 16 | { 17 | if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) 18 | return (1); 19 | return (0); 20 | } 21 | -------------------------------------------------------------------------------- /libft/ft_strlen.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* strlen.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 19:11:49 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/05 22:42:20 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | size_t ft_strlen(const char *str) 16 | { 17 | size_t i; 18 | 19 | i = 0; 20 | while (str[i] != '\0') 21 | i++; 22 | return (i); 23 | } 24 | -------------------------------------------------------------------------------- /libft/ft_tolower.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_tolower.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 20:54:40 by jadawson #+# #+# */ 9 | /* Updated: 2018/02/20 20:06:30 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_tolower(int c) 16 | { 17 | if (c >= 'A' && c <= 'Z') 18 | { 19 | c = c + 32; 20 | return (c); 21 | } 22 | return (c); 23 | } 24 | -------------------------------------------------------------------------------- /libft/ft_toupper.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_toupper.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 20:53:30 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/05 22:49:40 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_toupper(int c) 16 | { 17 | if (c >= 'a' && c <= 'z') 18 | { 19 | c = c - 32; 20 | return (c); 21 | } 22 | return (c); 23 | } 24 | -------------------------------------------------------------------------------- /libft/ft_isalnum.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isalnum.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 20:20:41 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/03 16:44:00 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_isalnum(int c) 16 | { 17 | if (ft_isalpha(c)) 18 | return (1); 19 | if (ft_isdigit(c)) 20 | return (1); 21 | return (0); 22 | } 23 | -------------------------------------------------------------------------------- /tot_b.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* tot_b.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/10/09 17:56:01 by jadawson #+# #+# */ 9 | /* Updated: 2018/11/03 14:29:25 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | int tot_b(t_nums *b) 16 | { 17 | int i; 18 | 19 | i = 0; 20 | while (b) 21 | { 22 | i++; 23 | b = b->next; 24 | } 25 | return (i); 26 | } 27 | -------------------------------------------------------------------------------- /libft/ft_bzero.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_bzero.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/20 18:57:19 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/08 19:33:03 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_bzero(void *s, size_t n) 16 | { 17 | char *p; 18 | 19 | p = s; 20 | while (n > 0) 21 | { 22 | *p = '\0'; 23 | p++; 24 | n--; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /libft/ft_putendl_fd.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putendl_fd.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/03/04 20:42:04 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/08 22:33:49 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putendl_fd(char const *s, int fd) 16 | { 17 | if (s == NULL) 18 | return ; 19 | ft_putstr_fd(s, fd); 20 | ft_putchar_fd('\n', fd); 21 | } 22 | -------------------------------------------------------------------------------- /libft/ft_strclr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strclr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/22 20:05:10 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/07 20:40:07 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_strclr(char *s) 16 | { 17 | int i; 18 | 19 | i = 0; 20 | if (!s) 21 | return ; 22 | while (s[i]) 23 | { 24 | s[i] = '\0'; 25 | i++; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /range.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* range.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/10/03 19:13:02 by jadawson #+# #+# */ 9 | /* Updated: 2018/11/03 16:21:21 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | int range(t_nums *a, int local_max) 16 | { 17 | while (a) 18 | { 19 | if (a->num <= local_max) 20 | return (1); 21 | a = a->next; 22 | } 23 | return (0); 24 | } 25 | -------------------------------------------------------------------------------- /libft/ft_lstadd.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstadd.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/03/09 22:58:07 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/09 23:59:06 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_lstadd(t_list **alst, t_list *new) 16 | { 17 | if (!alst || !new) 18 | return ; 19 | if (new) 20 | { 21 | new->next = *alst; 22 | *alst = new; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /libft/ft_strequ.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strequ.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 21:08:43 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/06 21:51:29 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_strequ(char const *s1, char const *s2) 16 | { 17 | if (!s1 || !s2) 18 | return (0); 19 | else if (!(ft_strcmp(s1, s2))) 20 | return (1); 21 | return (0); 22 | } 23 | -------------------------------------------------------------------------------- /libft/ft_striter.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_striter.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/20 13:32:45 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/07 20:47:40 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_striter(char *s, void (*f)(char *)) 16 | { 17 | if (s == NULL || f == NULL) 18 | return ; 19 | if (s && f) 20 | { 21 | while (*s) 22 | f(s++); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /libft/ft_lstiter.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstiter.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/03/10 14:20:51 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/10 16:51:00 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_lstiter(t_list *lst, void (*f)(t_list *elem)) 16 | { 17 | if (!lst || !f) 18 | return ; 19 | while (lst) 20 | { 21 | f(lst); 22 | lst = lst->next; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /libft/ft_putstr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putstr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/20 13:39:09 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/06 23:39:29 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putstr(char const *s) 16 | { 17 | int i; 18 | 19 | i = 0; 20 | if (!s) 21 | return ; 22 | while (s[i] != '\0') 23 | { 24 | ft_putchar(s[i]); 25 | i++; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /libft/ft_strnequ.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strnequ.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 21:11:08 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/09 14:39:57 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_strnequ(const char *s1, const char *s2, size_t n) 16 | { 17 | if (!s1 || !s2) 18 | return (0); 19 | else if (!(ft_strncmp(s1, s2, n))) 20 | return (1); 21 | return (0); 22 | } 23 | -------------------------------------------------------------------------------- /pa.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* pa.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/08/30 21:52:47 by jadawson #+# #+# */ 9 | /* Updated: 2018/10/16 16:06:07 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | void push_a(t_nums **a, t_nums **b) 16 | { 17 | t_nums *bot_b; 18 | 19 | if (*b == NULL) 20 | return ; 21 | bot_b = (*b)->next; 22 | (*b)->next = *a; 23 | *a = *b; 24 | *b = bot_b; 25 | } 26 | -------------------------------------------------------------------------------- /pb.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* pb.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/09/01 16:09:22 by jadawson #+# #+# */ 9 | /* Updated: 2018/10/16 16:06:16 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | void push_b(t_nums **a, t_nums **b) 16 | { 17 | t_nums *bot_a; 18 | 19 | if (*a == NULL) 20 | return ; 21 | bot_a = (*a)->next; 22 | (*a)->next = *b; 23 | *b = *a; 24 | *a = bot_a; 25 | } 26 | -------------------------------------------------------------------------------- /libft/ft_strcmp.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* strcmp.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 19:08:28 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/06 00:00:43 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_strcmp(const char *s1, const char *s2) 16 | { 17 | while (*s1 && *s2 && *s1 == *s2) 18 | { 19 | s1++; 20 | s2++; 21 | } 22 | return ((unsigned char)*s1 - (unsigned char)*s2); 23 | } 24 | -------------------------------------------------------------------------------- /min_finder.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* min_finder.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/09/14 17:27:33 by jadawson #+# #+# */ 9 | /* Updated: 2018/10/16 16:05:33 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | int min_finder(t_nums *a, int min) 16 | { 17 | min = a->num; 18 | while (a != NULL) 19 | { 20 | if (min >= a->num) 21 | min = a->num; 22 | a = a->next; 23 | } 24 | return (min); 25 | } 26 | -------------------------------------------------------------------------------- /libft/ft_memalloc.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memalloc.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 20:57:55 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/08 19:32:48 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_memalloc(size_t size) 16 | { 17 | void *memory; 18 | 19 | memory = malloc(size); 20 | if (memory == NULL) 21 | return (NULL); 22 | ft_bzero(memory, size); 23 | return (memory); 24 | } 25 | -------------------------------------------------------------------------------- /libft/ft_strchr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* strchr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 19:25:26 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/05 22:27:27 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strchr(const char *s, int c) 16 | { 17 | while (*s) 18 | { 19 | if (*s == c) 20 | return ((char *)s); 21 | s++; 22 | } 23 | if (!c) 24 | return ((char *)s); 25 | return (NULL); 26 | } 27 | -------------------------------------------------------------------------------- /libft/ft_lstdelone.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstdelone.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/03/09 14:45:35 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/10 17:48:35 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_lstdelone(t_list **alst, void (*del)(void *, size_t)) 16 | { 17 | if (!alst || !del) 18 | return ; 19 | del((*alst)->content, (*alst)->content_size); 20 | free(*alst); 21 | *alst = NULL; 22 | } 23 | -------------------------------------------------------------------------------- /sa.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* sa.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/08/26 23:00:25 by jadawson #+# #+# */ 9 | /* Updated: 2018/10/16 16:07:23 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | void swap_a(t_nums **nums) 16 | { 17 | t_nums *temp; 18 | 19 | if (*nums == NULL) 20 | return ; 21 | temp = *nums; 22 | *nums = (*nums)->next; 23 | temp->next = (*nums)->next; 24 | (*nums)->next = temp; 25 | } 26 | -------------------------------------------------------------------------------- /sb.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* sb.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/08/27 20:33:24 by jadawson #+# #+# */ 9 | /* Updated: 2018/10/16 16:07:27 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | void swap_b(t_nums **nums) 16 | { 17 | t_nums *temp; 18 | 19 | if (*nums == NULL) 20 | return ; 21 | temp = *nums; 22 | *nums = (*nums)->next; 23 | temp->next = (*nums)->next; 24 | (*nums)->next = temp; 25 | } 26 | -------------------------------------------------------------------------------- /libft/ft_striteri.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_striteri.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/23 16:44:06 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/10 18:20:04 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_striteri(char *s, void (*f)(unsigned int, char *)) 16 | { 17 | unsigned int i; 18 | 19 | i = 0; 20 | if (!s || !f) 21 | return ; 22 | while (s[i]) 23 | { 24 | (f)(i, &s[i]); 25 | i++; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /libft/ft_strcpy.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* strcpy.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 19:10:05 by jadawson #+# #+# */ 9 | /* Updated: 2018/02/20 18:55:24 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strcpy(char *dest, char *src) 16 | { 17 | char *result; 18 | 19 | result = dest; 20 | while (*src != '\0') 21 | { 22 | *dest = *src; 23 | dest++; 24 | src++; 25 | } 26 | *dest = '\0'; 27 | return (result); 28 | } 29 | -------------------------------------------------------------------------------- /libft/ft_strrchr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* strrchr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 19:43:21 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/10 17:39:56 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strrchr(const char *s, int c) 16 | { 17 | size_t i; 18 | 19 | i = 0; 20 | while (s[i++]) 21 | ; 22 | while (i--) 23 | { 24 | if (s[i] == (char)c) 25 | return ((char *)&s[i]); 26 | } 27 | return (NULL); 28 | } 29 | -------------------------------------------------------------------------------- /biggest_finder.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* biggest_finder.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/10/01 22:08:07 by jadawson #+# #+# */ 9 | /* Updated: 2018/10/30 11:04:46 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | long biggest_finder(t_nums *a) 16 | { 17 | int biggest; 18 | 19 | biggest = a->num; 20 | while (a != NULL) 21 | { 22 | if (biggest <= a->num) 23 | biggest = a->num; 24 | a = a->next; 25 | } 26 | return (biggest); 27 | } 28 | -------------------------------------------------------------------------------- /libft/ft_lstmap.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstmap.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/03/10 16:52:57 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/10 17:40:55 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | t_list *ft_lstmap(t_list *lst, t_list *(*f)(t_list *elem)) 16 | { 17 | t_list *new; 18 | 19 | while (lst) 20 | { 21 | new = f(lst); 22 | new->next = ft_lstmap(lst->next, f); 23 | return (new); 24 | } 25 | return (NULL); 26 | } 27 | -------------------------------------------------------------------------------- /libft/ft_strcat.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* strcat.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 19:15:55 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/07 20:32:25 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strcat(char *s1, const char *s2) 16 | { 17 | char *temp; 18 | 19 | temp = s1; 20 | while (*s1) 21 | s1++; 22 | while (*s2) 23 | { 24 | *s1 = *s2; 25 | s1++; 26 | s2++; 27 | } 28 | *s1 = '\0'; 29 | return (temp); 30 | } 31 | -------------------------------------------------------------------------------- /smallest_finder.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* smallest_finder.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/10/04 21:46:24 by jadawson #+# #+# */ 9 | /* Updated: 2018/10/16 16:07:33 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | long smallest_finder(t_nums *b) 16 | { 17 | int smallest; 18 | 19 | smallest = b->num; 20 | while (b != NULL) 21 | { 22 | if (smallest >= b->num) 23 | smallest = b->num; 24 | b = b->next; 25 | } 26 | return (smallest); 27 | } 28 | -------------------------------------------------------------------------------- /first_confirmed_ordered.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* first_confirmed_ordered.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/09/01 17:54:48 by jadawson #+# #+# */ 9 | /* Updated: 2018/10/16 16:04:06 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | int first_confirmed_ordered(t_nums *nums) 16 | { 17 | while (nums) 18 | { 19 | if (nums->next) 20 | { 21 | if (nums->num > nums->next->num) 22 | return (1); 23 | } 24 | nums = nums->next; 25 | } 26 | return (0); 27 | } 28 | -------------------------------------------------------------------------------- /libft/ft_putstr_fd.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putstr_fd.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/20 14:51:18 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/06 22:36:49 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putstr_fd(char const *s, int fd) 16 | { 17 | int i; 18 | 19 | i = 0; 20 | if (!s || !fd) 21 | return ; 22 | if (s[i] == '\0') 23 | return ; 24 | while (s[i] != '\0') 25 | { 26 | ft_putchar_fd(s[i], fd); 27 | i++; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /gnl/get_next_line.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* get_next_line.h :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/04/10 16:06:45 by jadawson #+# #+# */ 9 | /* Updated: 2018/09/05 19:05:38 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #ifndef GET_NEXT_LINE_H 14 | # define GET_NEXT_LINE_H 15 | # define BUFF_SIZE 32 16 | 17 | # include 18 | # include 19 | # include 20 | # include 21 | # include "../libft/libft.h" 22 | 23 | int get_next_line(const int fd, char **line); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /libft/ft_memchr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* memchr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 18:59:21 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/07 19:31:02 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_memchr(const void *s, int c, size_t n) 16 | { 17 | unsigned char *find; 18 | 19 | find = (unsigned char*)s; 20 | while (n > 0) 21 | { 22 | if (*find == (unsigned char)c) 23 | return (find); 24 | find++; 25 | n--; 26 | } 27 | return (NULL); 28 | } 29 | -------------------------------------------------------------------------------- /libft/ft_numlen.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_numlen.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/03/09 13:53:44 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/10 17:32:01 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_numlen(int x) 16 | { 17 | long i; 18 | int length; 19 | 20 | i = (long)x; 21 | length = 0; 22 | if (i <= 0) 23 | { 24 | length++; 25 | i = -i; 26 | } 27 | while (i != 0) 28 | { 29 | length++; 30 | i /= 10; 31 | } 32 | return (length); 33 | } 34 | -------------------------------------------------------------------------------- /libft/ft_strncmp.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strncmp.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/25 21:52:59 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/09 14:39:54 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_strncmp(const char *s1, const char *s2, size_t n) 16 | { 17 | size_t i; 18 | 19 | i = 0; 20 | if (!n) 21 | return (0); 22 | while (s1[i] && s2[i] && s1[i] == s2[i] && i < n - 1) 23 | i++; 24 | return (((unsigned char*)s1)[i] - ((unsigned char*)s2)[i]); 25 | } 26 | -------------------------------------------------------------------------------- /libft/ft_putnbr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putnbr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/20 13:42:37 by jadawson #+# #+# */ 9 | /* Updated: 2018/02/20 19:10:13 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putnbr(int nb) 16 | { 17 | long long nnb; 18 | 19 | nnb = nb; 20 | if (nnb < 0) 21 | { 22 | ft_putchar('-'); 23 | nnb = -nnb; 24 | } 25 | if (nnb >= 10) 26 | { 27 | ft_putnbr(nnb / 10); 28 | ft_putnbr(nnb % 10); 29 | } 30 | else 31 | ft_putchar(nnb + '0'); 32 | } 33 | -------------------------------------------------------------------------------- /libft/ft_memset.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* memset.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 18:29:09 by jadawson #+# #+# */ 9 | /* Updated: 2018/02/20 15:53:09 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_memset(void *ptr, int value, size_t num) 16 | { 17 | unsigned char *let; 18 | 19 | if (num == 0) 20 | return (ptr); 21 | let = (unsigned char *)ptr; 22 | while (num--) 23 | { 24 | *let = (unsigned char)value; 25 | if (num) 26 | let++; 27 | } 28 | return (ptr); 29 | } 30 | -------------------------------------------------------------------------------- /free_here.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* free_here.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/11/12 22:34:11 by jadawson #+# #+# */ 9 | /* Updated: 2018/11/13 16:49:17 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | void free_a_and_b(t_nums **a, t_nums **b) 16 | { 17 | free_here(a); 18 | free_here(b); 19 | } 20 | 21 | void free_here(t_nums **all) 22 | { 23 | t_nums *tmp; 24 | 25 | while (*all) 26 | { 27 | tmp = *all; 28 | tmp->num = 0; 29 | (*all) = (*all)->next; 30 | free(tmp); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /libft/ft_strrev.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strrev.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/03/10 20:18:14 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/12 14:59:55 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strrev(char *str) 16 | { 17 | char temp; 18 | int len; 19 | int n; 20 | 21 | n = 0; 22 | len = 0; 23 | while (str[len]) 24 | len++; 25 | len--; 26 | while (n < len) 27 | { 28 | temp = str[len]; 29 | str[len--] = str[n]; 30 | str[n++] = temp; 31 | } 32 | return (str); 33 | } 34 | -------------------------------------------------------------------------------- /libft/ft_lstdel.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstdel.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/03/09 22:10:38 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/10 17:32:36 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_lstdel(t_list **alst, void (*del)(void *, size_t)) 16 | { 17 | t_list *tmp; 18 | 19 | if (!alst || !del) 20 | return ; 21 | while (*alst) 22 | { 23 | tmp = (*alst)->next; 24 | del((*alst)->content, (*alst)->content_size); 25 | free(*alst); 26 | *alst = tmp; 27 | } 28 | *alst = NULL; 29 | } 30 | -------------------------------------------------------------------------------- /ra.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ra.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/08/29 18:59:25 by jadawson #+# #+# */ 9 | /* Updated: 2018/10/16 16:06:44 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | void rotate_a(t_nums **nums) 16 | { 17 | t_nums *head; 18 | 19 | head = *nums; 20 | if (*nums == NULL) 21 | return ; 22 | while ((*nums)->next != NULL) 23 | *nums = (*nums)->next; 24 | (*nums)->next = head; 25 | head = head->next; 26 | *nums = (*nums)->next; 27 | (*nums)->next = NULL; 28 | *nums = head; 29 | } 30 | -------------------------------------------------------------------------------- /rb.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* rb.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/08/30 18:59:52 by jadawson #+# #+# */ 9 | /* Updated: 2018/10/30 14:20:42 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | void rotate_b(t_nums **nums) 16 | { 17 | t_nums *head; 18 | 19 | head = *nums; 20 | if (*nums == NULL) 21 | return ; 22 | while ((*nums)->next != NULL) 23 | *nums = (*nums)->next; 24 | (*nums)->next = head; 25 | head = head->next; 26 | *nums = (*nums)->next; 27 | (*nums)->next = NULL; 28 | *nums = head; 29 | } 30 | -------------------------------------------------------------------------------- /final_confirmed_ordered.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* final_confirmed_ordered.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/09/01 17:55:20 by jadawson #+# #+# */ 9 | /* Updated: 2018/10/30 11:21:44 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | int final_confirmed_ordered(t_nums *nums, t_nums *b) 16 | { 17 | if (b) 18 | return (1); 19 | if (!nums) 20 | return (1); 21 | while (nums) 22 | { 23 | if (nums->next) 24 | { 25 | if (nums->num > nums->next->num) 26 | return (1); 27 | } 28 | nums = nums->next; 29 | } 30 | return (0); 31 | } 32 | -------------------------------------------------------------------------------- /libft/ft_strdup.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* strdup.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 19:13:31 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/05 22:24:17 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strdup(char *src) 16 | { 17 | char *result; 18 | int i; 19 | 20 | i = 0; 21 | while (src[i]) 22 | i++; 23 | if ((result = malloc(i + 1))) 24 | { 25 | i = 0; 26 | while (src[i] != '\0') 27 | { 28 | result[i] = src[i]; 29 | i++; 30 | } 31 | result[i] = '\0'; 32 | } 33 | return (result); 34 | } 35 | -------------------------------------------------------------------------------- /libft/ft_putnbr_fd.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putnbr_fd.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/20 14:49:18 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/10 18:19:44 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putnbr_fd(int n, int fd) 16 | { 17 | long long nnb; 18 | 19 | nnb = n; 20 | if (nnb < 0) 21 | { 22 | ft_putchar_fd('-', fd); 23 | nnb = -nnb; 24 | } 25 | if (nnb >= 10) 26 | { 27 | ft_putnbr_fd((nnb) / 10, fd); 28 | ft_putnbr_fd((nnb) % 10, fd); 29 | } 30 | else 31 | ft_putchar_fd(nnb + '0', fd); 32 | } 33 | -------------------------------------------------------------------------------- /libft/ft_strncat.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strncat.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 19:20:11 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/07 20:16:56 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strncat(char *dest, const char *src, size_t num) 16 | { 17 | char *temp; 18 | unsigned int i; 19 | 20 | temp = dest; 21 | i = 0; 22 | while (*dest) 23 | dest++; 24 | while (*src && num > i) 25 | { 26 | *dest = *src; 27 | dest++; 28 | src++; 29 | i++; 30 | } 31 | *dest = '\0'; 32 | return (temp); 33 | } 34 | -------------------------------------------------------------------------------- /libft/ft_is_prime.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_is_prime.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/03/10 20:44:55 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/10 20:49:06 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_is_prime(int nb) 16 | { 17 | int i; 18 | 19 | i = 3; 20 | if (nb <= 1) 21 | return (0); 22 | if (nb == 2 || nb == 3) 23 | return (1); 24 | if (nb % 2 == 0 || nb % 3 == 0) 25 | return (0); 26 | while ((i * i) <= nb) 27 | { 28 | if ((nb % i) == 0) 29 | return (0); 30 | i += 2; 31 | } 32 | return (1); 33 | } 34 | -------------------------------------------------------------------------------- /libft/ft_memmove.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* memmove.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 19:02:55 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/07 20:44:43 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_memmove(void *dest, const void *src, size_t n) 16 | { 17 | size_t i; 18 | unsigned char *temp; 19 | unsigned char *new; 20 | 21 | i = 0; 22 | temp = (unsigned char*)src; 23 | new = dest; 24 | if (temp < new) 25 | while (n--) 26 | new[n] = temp[n]; 27 | else 28 | ft_memcpy(new, temp, n); 29 | return (dest); 30 | } 31 | -------------------------------------------------------------------------------- /libft/ft_count_words.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_count_words.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/03/09 13:51:19 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/09 13:52:16 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_count_words(char *str, char c) 16 | { 17 | int i; 18 | int words; 19 | 20 | i = 0; 21 | words = 0; 22 | while (str[i] != '\0') 23 | { 24 | while (!(str[i] == c)) 25 | if (str[i] != '\0') 26 | i++; 27 | else 28 | break ; 29 | while (str[i] == c) 30 | i++; 31 | words++; 32 | } 33 | return (words); 34 | } 35 | -------------------------------------------------------------------------------- /libft/ft_strncpy.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* strncpy.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 19:14:52 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/10 17:40:24 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strncpy(char *dest, const char *src, size_t n) 16 | { 17 | size_t i; 18 | const char *gather; 19 | char *final; 20 | 21 | i = 0; 22 | gather = src; 23 | final = dest; 24 | ft_bzero(final, n); 25 | while (*gather && i < n) 26 | { 27 | *dest = *gather; 28 | i++; 29 | dest++; 30 | gather++; 31 | } 32 | return (final); 33 | } 34 | -------------------------------------------------------------------------------- /libft/ft_memcmp.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* memcmp.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 19:01:34 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/07 20:19:56 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_memcmp(const void *s1, const void *s2, size_t n) 16 | { 17 | size_t i; 18 | unsigned char *one; 19 | unsigned char *two; 20 | 21 | one = (unsigned char *)s1; 22 | two = (unsigned char *)s2; 23 | i = 0; 24 | while (i < n) 25 | { 26 | if ((one)[i] != (two)[i]) 27 | return ((one)[i] - (two)[i]); 28 | i++; 29 | } 30 | return (0); 31 | } 32 | -------------------------------------------------------------------------------- /libft/ft_memcpy.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memcpy.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 18:32:23 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/07 20:43:59 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_memcpy(void *dst, const void *src, size_t n) 16 | { 17 | size_t i; 18 | unsigned char *collect; 19 | unsigned char *final; 20 | 21 | i = 0; 22 | collect = (unsigned char*)src; 23 | final = (unsigned char*)dst; 24 | while (i < n) 25 | { 26 | *final = *collect; 27 | i++; 28 | final++; 29 | collect++; 30 | } 31 | return (dst); 32 | } 33 | -------------------------------------------------------------------------------- /libft/ft_strsub.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strsub.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/20 13:31:54 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/06 22:07:51 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strsub(char const *s, unsigned int start, size_t len) 16 | { 17 | char *dest; 18 | size_t i; 19 | 20 | i = 0; 21 | dest = (char *)malloc((len + 1) * sizeof(char)); 22 | if (dest && s) 23 | { 24 | while (i < len) 25 | { 26 | dest[i] = s[start]; 27 | i++; 28 | start++; 29 | } 30 | dest[i] = '\0'; 31 | return (dest); 32 | } 33 | return (NULL); 34 | } 35 | -------------------------------------------------------------------------------- /libft/ft_strmapi.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* strmapi.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/20 13:38:01 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/10 18:22:02 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strmapi(char const *s, char (*f)(unsigned int, char)) 16 | { 17 | int i; 18 | char *ptr; 19 | 20 | if (!s || !f) 21 | return (NULL); 22 | ptr = (char *)malloc((ft_strlen(s) + 1) * sizeof(char)); 23 | i = 0; 24 | if (ptr) 25 | { 26 | while (s[i]) 27 | { 28 | ptr[i] = f(i, s[i]); 29 | i++; 30 | } 31 | ptr[i] = '\0'; 32 | return (ptr); 33 | } 34 | return (NULL); 35 | } 36 | -------------------------------------------------------------------------------- /libft/ft_strnstr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* strnstr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 19:40:57 by jadawson #+# #+# */ 9 | /* Updated: 2018/09/10 00:25:30 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strnstr(const char *big, const char *l, size_t len) 16 | { 17 | unsigned long i; 18 | int x; 19 | 20 | x = 0; 21 | i = 0; 22 | if (!*l) 23 | return ((char *)big); 24 | while (big[i]) 25 | { 26 | x = 0; 27 | while (big[i] == l[x] && big[i] && i < len) 28 | { 29 | i++; 30 | x++; 31 | } 32 | if (!l[x]) 33 | return ((char *)&big[i - x]); 34 | i = (i - x) + 1; 35 | } 36 | return (NULL); 37 | } 38 | -------------------------------------------------------------------------------- /libft/ft_strstr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* strstr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 19:26:36 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/10 18:15:13 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strstr(const char *haystack, const char *needle) 16 | { 17 | size_t i; 18 | size_t j; 19 | 20 | i = 0; 21 | if (!*needle) 22 | return ((char*)haystack); 23 | while (haystack[i]) 24 | { 25 | j = 0; 26 | while (haystack[i] == needle[j] && haystack[i]) 27 | { 28 | i++; 29 | j++; 30 | } 31 | if (!needle[j]) 32 | return ((char*)&haystack[i - j]); 33 | i = (i - j) + 1; 34 | } 35 | return (NULL); 36 | } 37 | -------------------------------------------------------------------------------- /libft/ft_strlcat.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* strlcat.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 19:23:06 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/05 22:55:56 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | size_t ft_strlcat(char *dest, const char *src, size_t num) 16 | { 17 | size_t i; 18 | size_t j; 19 | size_t l; 20 | 21 | i = 0; 22 | while (i < num && dest[i] != '\0') 23 | i++; 24 | l = i; 25 | if (i == num) 26 | return (num + ft_strlen(src)); 27 | j = 0; 28 | while (src[j] != '\0' && i < num - 1) 29 | { 30 | dest[i] = src[j]; 31 | i++; 32 | j++; 33 | } 34 | dest[i] = '\0'; 35 | return (l + ft_strlen(src)); 36 | } 37 | -------------------------------------------------------------------------------- /libft/ft_memccpy.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memccpy.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 18:56:55 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/10 17:48:17 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_memccpy(void *dst, const void *src, int c, size_t n) 16 | { 17 | unsigned char *collect; 18 | unsigned char *final; 19 | size_t i; 20 | 21 | i = 0; 22 | final = (unsigned char *)dst; 23 | collect = (unsigned char *)src; 24 | while (i++ < n) 25 | { 26 | if (*collect == (unsigned char)c) 27 | { 28 | *final++ = *collect++; 29 | return (final); 30 | } 31 | *final++ = *collect++; 32 | } 33 | return (NULL); 34 | } 35 | -------------------------------------------------------------------------------- /libft/ft_strmap.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strmap.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/20 13:36:47 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/10 18:21:16 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strmap(char const *s, char (*f)(char)) 16 | { 17 | unsigned i; 18 | char *string; 19 | char *ptr; 20 | 21 | if (!s) 22 | return (NULL); 23 | string = (char*)s; 24 | i = ft_strlen((char*)s); 25 | ptr = (char*)malloc(sizeof(char) * (i + 1)); 26 | i = 0; 27 | if (ptr == NULL) 28 | return (NULL); 29 | while (string[i]) 30 | { 31 | ptr[i] = f(string[i]); 32 | i++; 33 | } 34 | ptr[i] = '\0'; 35 | return (ptr); 36 | } 37 | -------------------------------------------------------------------------------- /rra.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* rra.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/08/30 19:08:32 by jadawson #+# #+# */ 9 | /* Updated: 2018/10/16 16:07:16 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | void reverse_rotate_a(t_nums **nums) 16 | { 17 | t_nums *front; 18 | t_nums *back; 19 | t_nums *head; 20 | 21 | head = *nums; 22 | back = *nums; 23 | front = *nums; 24 | if (*nums == NULL) 25 | return ; 26 | while (front->next != NULL) 27 | { 28 | front = front->next; 29 | if (front->next != NULL) 30 | back = back->next; 31 | } 32 | if (front->next == NULL) 33 | { 34 | front->next = head; 35 | back->next = NULL; 36 | } 37 | *nums = front; 38 | } 39 | -------------------------------------------------------------------------------- /rrb.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* rrb.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/08/30 21:49:06 by jadawson #+# #+# */ 9 | /* Updated: 2018/09/10 19:49:20 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | void reverse_rotate_b(t_nums **nums) 16 | { 17 | t_nums *front; 18 | t_nums *back; 19 | t_nums *head; 20 | 21 | head = *nums; 22 | back = *nums; 23 | front = *nums; 24 | if (*nums == NULL) 25 | return ; 26 | while (front->next != NULL) 27 | { 28 | front = front->next; 29 | if (front->next != NULL) 30 | back = back->next; 31 | } 32 | if (front->next == NULL) 33 | { 34 | front->next = head; 35 | back->next = NULL; 36 | } 37 | *nums = front; 38 | } 39 | -------------------------------------------------------------------------------- /libft/ft_itoa.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_itoa.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/28 21:41:31 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/09 13:54:10 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_itoa(int i) 16 | { 17 | char *ptr; 18 | int len; 19 | long change; 20 | 21 | change = (long)i; 22 | len = ft_numlen(change); 23 | if ((ptr = ft_strnew(len)) == NULL) 24 | return (NULL); 25 | ptr[len--] = '\0'; 26 | if (change < 0) 27 | { 28 | ptr[0] = '-'; 29 | change = -change; 30 | } 31 | ptr[len--] = (change % 10) + '0'; 32 | while (change >= 10) 33 | { 34 | change /= 10; 35 | ptr[len--] = (change % 10) + '0'; 36 | } 37 | return (ptr); 38 | } 39 | -------------------------------------------------------------------------------- /libft/ft_lstnew.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstnew.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/03/04 20:48:11 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/10 18:15:27 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | t_list *ft_lstnew(void const *content, size_t content_size) 16 | { 17 | t_list *listnew; 18 | 19 | if (!(listnew = ft_memalloc(sizeof(t_list)))) 20 | return (NULL); 21 | if (content == 0 || content_size == 0) 22 | ; 23 | else if ((listnew->content = ft_memalloc(content_size))) 24 | { 25 | listnew->content_size = content_size; 26 | ft_memcpy(listnew->content, content, content_size); 27 | } 28 | else 29 | ft_memdel((void**)&listnew); 30 | return (listnew); 31 | } 32 | -------------------------------------------------------------------------------- /str_n_file.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* str_n_file.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/10/29 22:42:46 by jadawson #+# #+# */ 9 | /* Updated: 2018/10/29 22:47:43 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | char **str_n(int argc, char **argv) 16 | { 17 | if (argc < 2 || !argv[1][0]) 18 | exit(1); 19 | if (argc == 3 && !argv[2][0]) 20 | exit(1); 21 | if (argv[1][0] == '-' && argv[1][1] == 'n') 22 | { 23 | if (argc == 3) 24 | return (ft_strsplit(argv[2], ' ')); 25 | else 26 | return (&argv[2]); 27 | } 28 | else 29 | { 30 | if (argc == 2) 31 | return (ft_strsplit(argv[1], ' ')); 32 | else 33 | return (&argv[1]); 34 | } 35 | return (&argv[1]); 36 | } 37 | -------------------------------------------------------------------------------- /libft/ft_strjoin.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strjoin.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/20 14:53:26 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/10 17:50:47 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strjoin(char const *s1, char const *s2) 16 | { 17 | int i; 18 | int tot; 19 | char *tmp; 20 | 21 | if (!s1 || !s2) 22 | return (NULL); 23 | tot = (ft_strlen((char *)s1) + ft_strlen((char *)s2)); 24 | tmp = (char *)malloc(sizeof(*tmp) * (tot) + 1); 25 | i = 0; 26 | if (tmp) 27 | { 28 | while (*s1) 29 | { 30 | tmp[i] = *s1++; 31 | i++; 32 | } 33 | while (*s2) 34 | { 35 | tmp[i] = *s2++; 36 | i++; 37 | } 38 | tmp[i] = '\0'; 39 | return (tmp); 40 | } 41 | return (NULL); 42 | } 43 | -------------------------------------------------------------------------------- /libft/ft_atoi.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_atoi.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/21 15:07:12 by jadawson #+# #+# */ 9 | /* Updated: 2018/09/08 21:48:05 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | long long ft_atoi(const char *str) 16 | { 17 | long long i; 18 | long long nbr; 19 | int negative; 20 | 21 | nbr = 0; 22 | negative = 1; 23 | i = 0; 24 | while ((str[i] == '\n') || (str[i] == '\t') || (str[i] == '\v') || 25 | (str[i] == ' ') || (str[i] == '\f') || (str[i] == '\r')) 26 | i++; 27 | if (str[i] == '-') 28 | negative = -1; 29 | if (str[i] == '+' || str[i] == '-') 30 | i++; 31 | while (str[i] && (str[i] >= '0') && (str[i] <= '9')) 32 | { 33 | nbr = (nbr * 10) + (str[i] - '0'); 34 | i++; 35 | } 36 | return (nbr * negative); 37 | } 38 | -------------------------------------------------------------------------------- /libft/ft_strtrim.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strtrim.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/28 15:17:02 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/10 19:37:07 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strtrim(char const *s) 16 | { 17 | int i; 18 | int j; 19 | int tot; 20 | char *str; 21 | char *ptr; 22 | 23 | i = 0; 24 | j = 0; 25 | str = (char*)s; 26 | if (!s) 27 | return (NULL); 28 | while (str[i]) 29 | i++; 30 | while (str[j] == ' ' || str[j] == '\n' || str[j] == '\t') 31 | j++; 32 | while (str[i - 1] == ' ' || str[i - 1] == '\n' || str[i - 1] == '\t') 33 | i--; 34 | tot = i - j; 35 | if (tot < 0) 36 | tot = 0; 37 | if ((ptr = (char*)malloc(sizeof(char) * tot + 1)) == NULL) 38 | return (NULL); 39 | ft_strncpy(ptr, &s[j], tot); 40 | ptr[tot] = '\0'; 41 | return (ptr); 42 | } 43 | -------------------------------------------------------------------------------- /sort_three.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* sort_three.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/09/21 22:02:28 by jadawson #+# #+# */ 9 | /* Updated: 2018/10/30 11:43:31 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | int sort_three(t_nums **a) 16 | { 17 | int t; 18 | int m; 19 | int b; 20 | int i; 21 | 22 | t = (*a)->num; 23 | m = (*a)->next->num; 24 | b = (*a)->next->next->num; 25 | i = 0; 26 | if (t > m && m < b && b > t) 27 | i += sort_three_sa_and_write(a); 28 | if (t > m && m > b && b < t) 29 | i += sort_three_sa_and_rra(a); 30 | if (t > m && m < b && b < t) 31 | i += sort_three_ra_and_write(a); 32 | if (t < m && m > b && b > t) 33 | i += sort_three_sa_and_ra(a); 34 | if (t < m && m > b && b < t) 35 | i += sort_three_rra_and_write(a); 36 | if (first_confirmed_ordered(*a) == 0) 37 | return (i); 38 | return (0); 39 | } 40 | -------------------------------------------------------------------------------- /b_helper_functs.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* b_helper_functs.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/10/27 16:11:14 by jadawson #+# #+# */ 9 | /* Updated: 2018/10/30 14:52:05 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | int bottom_b_value(t_nums *b) 16 | { 17 | int i; 18 | 19 | i = 0; 20 | while (b && b->next) 21 | b = b->next; 22 | i = b->num; 23 | return (i); 24 | } 25 | 26 | int b_largest_location(t_nums *b, long b_largest) 27 | { 28 | int i; 29 | 30 | i = 0; 31 | while (i != b_largest) 32 | { 33 | if (b->num == b_largest) 34 | return (i); 35 | b = b->next; 36 | } 37 | return (i); 38 | } 39 | 40 | int b_empty_or_one(t_nums **a, t_nums **b) 41 | { 42 | int i; 43 | 44 | i = 0; 45 | i += push_b_and_write(a, b); 46 | return (i); 47 | } 48 | 49 | int b_small_pos_funct(t_nums *b, int b_smallest) 50 | { 51 | int pos_num; 52 | 53 | pos_num = 0; 54 | while (b) 55 | { 56 | if (b->num == b_smallest) 57 | { 58 | return (pos_num); 59 | } 60 | b = b->next; 61 | pos_num++; 62 | } 63 | return (pos_num); 64 | } 65 | -------------------------------------------------------------------------------- /helper_ra_rra.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* helper_ra_rra.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/10/27 16:25:28 by jadawson #+# #+# */ 9 | /* Updated: 2018/10/30 14:52:55 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | int ra_x_amount(t_nums **a, int pos) 16 | { 17 | int i; 18 | int tot; 19 | 20 | i = pos; 21 | tot = tot_b(*a); 22 | while (pos != 0) 23 | { 24 | rotate_a(a); 25 | write(1, "ra\n", 3); 26 | pos--; 27 | } 28 | return (i); 29 | } 30 | 31 | int rra_x_amount(t_nums **a, int pos) 32 | { 33 | int i; 34 | int tot; 35 | 36 | tot = tot_b(*a); 37 | pos = tot - pos; 38 | i = pos; 39 | while (pos != 0) 40 | { 41 | reverse_rotate_a(a); 42 | write(1, "rra\n", 4); 43 | pos--; 44 | } 45 | return (i); 46 | } 47 | 48 | int a_which_x_amount(t_nums **a, int range_pos) 49 | { 50 | int tot; 51 | int i; 52 | 53 | tot = 0; 54 | tot = tot_value(*a); 55 | i = 0; 56 | if (range_pos < tot / 2) 57 | i += ra_x_amount(a, range_pos); 58 | if (range_pos >= tot / 2) 59 | i += rra_x_amount(a, range_pos); 60 | return (i); 61 | } 62 | -------------------------------------------------------------------------------- /sort_three_solutions.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* sort_three_solutions.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/09/21 22:04:26 by jadawson #+# #+# */ 9 | /* Updated: 2018/11/04 18:27:22 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | int sort_three_sa_and_rra(t_nums **a) 16 | { 17 | int i; 18 | 19 | i = 2; 20 | swap_a(a); 21 | reverse_rotate_a(a); 22 | write(1, "sa\n", 3); 23 | write(1, "rra\n", 4); 24 | return (i); 25 | } 26 | 27 | int sort_three_sa_and_ra(t_nums **a) 28 | { 29 | int i; 30 | 31 | i = 2; 32 | swap_a(a); 33 | rotate_a(a); 34 | write(1, "sa\n", 3); 35 | write(1, "ra\n", 3); 36 | return (i); 37 | } 38 | 39 | int sort_three_sa_and_write(t_nums **a) 40 | { 41 | int i; 42 | 43 | i = 1; 44 | swap_a(a); 45 | write(1, "sa\n", 3); 46 | return (i); 47 | } 48 | 49 | int sort_three_ra_and_write(t_nums **a) 50 | { 51 | int i; 52 | 53 | i = 1; 54 | rotate_a(a); 55 | write(1, "ra\n", 3); 56 | return (i); 57 | } 58 | 59 | int sort_three_rra_and_write(t_nums **a) 60 | { 61 | int i; 62 | 63 | i = 1; 64 | reverse_rotate_a(a); 65 | write(1, "rra\n", 4); 66 | return (i); 67 | } 68 | -------------------------------------------------------------------------------- /my_insert_sort.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* my_insert_sort.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/09/24 20:34:39 by jadawson #+# #+# */ 9 | /* Updated: 2018/10/30 11:36:48 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | int tot_value(t_nums *a) 16 | { 17 | int i; 18 | 19 | i = 0; 20 | while (a) 21 | { 22 | if (a) 23 | i++; 24 | a = a->next; 25 | } 26 | return (i); 27 | } 28 | 29 | int push_b_and_write(t_nums **a, t_nums **b) 30 | { 31 | int i; 32 | 33 | i = 0; 34 | push_b(a, b); 35 | write(1, "pb\n", 3); 36 | i++; 37 | return (i); 38 | } 39 | 40 | int my_insert_sort(t_nums **a, t_nums **b, int i) 41 | { 42 | int small; 43 | int tot; 44 | int pos; 45 | 46 | while (*a) 47 | { 48 | small = min_finder(*a, small); 49 | tot = tot_value(*a); 50 | pos = pos_finder(*a, pos, small); 51 | if (small == (*a)->num) 52 | { 53 | small = push_and_find(a, b, small); 54 | tot = tot_value(*a); 55 | pos = pos_finder(*a, pos, small); 56 | i++; 57 | } 58 | if (*a) 59 | i += ra_or_rra(a, tot, pos); 60 | if (final_confirmed_ordered(*a, *b) == 0) 61 | return (i); 62 | if (*a) 63 | i += push_b_and_write(a, b); 64 | } 65 | return (i); 66 | } 67 | -------------------------------------------------------------------------------- /libft/ft_strsplit.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strsplit.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/03/02 22:23:53 by jadawson #+# #+# */ 9 | /* Updated: 2018/03/12 15:08:11 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | static char *ft_find_words(char *str, char c, int *index) 16 | { 17 | int i; 18 | int start; 19 | int end; 20 | char *dest; 21 | 22 | start = *index; 23 | i = start; 24 | while (!(str[i] == c)) 25 | if (str[i] != '\0') 26 | i++; 27 | else 28 | break ; 29 | end = i; 30 | dest = (char*)malloc(end - start + 1); 31 | while (str[i] == c) 32 | i++; 33 | *index = i; 34 | i = 0; 35 | while (i < end - start) 36 | { 37 | dest[i] = str[start + i]; 38 | i++; 39 | } 40 | dest[i] = '\0'; 41 | return (dest); 42 | } 43 | 44 | char **ft_strsplit(char *str, char c) 45 | { 46 | int i; 47 | int index; 48 | char **dest; 49 | 50 | i = 0; 51 | index = 0; 52 | if (!str || !c) 53 | return (NULL); 54 | dest = (char**)malloc(sizeof(char*) * (ft_count_words(str, c) + 1)); 55 | if (!dest) 56 | return (NULL); 57 | while (*str == c) 58 | str++; 59 | while (str[i] != '\0') 60 | { 61 | dest[index] = ft_find_words(str, c, &i); 62 | index++; 63 | } 64 | dest[index] = 0; 65 | return (dest); 66 | } 67 | -------------------------------------------------------------------------------- /checker.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* checker.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/09/18 20:11:23 by jadawson #+# #+# */ 9 | /* Updated: 2018/11/13 16:54:10 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | t_nums *create_a_list_c(int argc, char **argv, t_nums **a) 16 | { 17 | t_nums *hold_head; 18 | t_nums *head; 19 | t_nums *temp; 20 | int i; 21 | 22 | i = 2; 23 | head = malloc(sizeof(t_nums)); 24 | hold_head = head; 25 | head->num = ft_atoi_digit_confirm_c(argv[1], a); 26 | head->next = NULL; 27 | while (i < argc) 28 | { 29 | temp = malloc(sizeof(t_nums)); 30 | temp->num = ft_atoi_digit_confirm_c(argv[i], a); 31 | temp->next = NULL; 32 | hold_head->next = temp; 33 | hold_head = hold_head->next; 34 | dup_check_c(head, temp->num, a); 35 | i++; 36 | } 37 | return (head); 38 | } 39 | 40 | void print_ok_if_ordered(void) 41 | { 42 | ft_putstr("\033[32mOK\033[0m\n"); 43 | exit(1); 44 | } 45 | 46 | int main(int argc, char **argv) 47 | { 48 | t_nums *a; 49 | t_nums *b; 50 | 51 | if (argc < 2) 52 | return (0); 53 | a = create_a_list_c(argc, argv, &a); 54 | b = NULL; 55 | if (a == NULL) 56 | return (0); 57 | grab_command(&a, &b); 58 | free_here(&a); 59 | free_here(&b); 60 | return (0); 61 | } 62 | -------------------------------------------------------------------------------- /find_command.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* find_command.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/09/01 18:19:15 by jadawson #+# #+# */ 9 | /* Updated: 2018/11/12 22:29:28 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | int is_space(char c) 16 | { 17 | if (c == '\n' || c == '\t' || c == '\v' || c == ' ' || c == '\f' || 18 | c == '\r') 19 | return (1); 20 | return (0); 21 | } 22 | 23 | void command_not_found(void) 24 | { 25 | ft_putstr("\33[31mError\033[0330m\n"); 26 | exit(1); 27 | } 28 | 29 | void apply_command(char *str, t_nums **a, t_nums **b) 30 | { 31 | if (ft_strcmp(str, "sa") == 0) 32 | swap_a(a); 33 | else if (ft_strcmp(str, "sb") == 0) 34 | swap_b(b); 35 | else if (ft_strcmp(str, "ss") == 0) 36 | ss(a, b); 37 | else if (ft_strcmp(str, "pa") == 0) 38 | push_a(a, b); 39 | else if (ft_strcmp(str, "pb") == 0) 40 | push_b(a, b); 41 | else if (ft_strcmp(str, "ra") == 0) 42 | rotate_a(a); 43 | else if (ft_strcmp(str, "rb") == 0) 44 | rotate_b(b); 45 | else if (ft_strcmp(str, "rr") == 0) 46 | rr(a, b); 47 | else if (ft_strcmp(str, "rra") == 0) 48 | reverse_rotate_a(a); 49 | else if (ft_strcmp(str, "rrb") == 0) 50 | reverse_rotate_b(b); 51 | else if (ft_strcmp(str, "rrr") == 0) 52 | rrr(a, b); 53 | else 54 | command_not_found(); 55 | } 56 | -------------------------------------------------------------------------------- /grab_command.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* grab_command.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/09/05 16:27:08 by jadawson #+# #+# */ 9 | /* Updated: 2018/11/13 14:28:35 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | void dup_check_ps(t_nums *head, int nbr, t_nums **a) 16 | { 17 | int i; 18 | 19 | i = 0; 20 | while (head) 21 | { 22 | if (head->num == nbr) 23 | i++; 24 | head = head->next; 25 | } 26 | if (i >= 2) 27 | { 28 | ft_putstr("\33[31mError\033[0m\n"); 29 | free_here(a); 30 | exit(1); 31 | } 32 | } 33 | 34 | void dup_check_c(t_nums *head, int nbr, t_nums **a) 35 | { 36 | int i; 37 | 38 | i = 0; 39 | while (head) 40 | { 41 | if (head->num == nbr) 42 | i++; 43 | head = head->next; 44 | } 45 | if (i >= 2) 46 | { 47 | ft_putstr("\33[31mError\033[0m\n"); 48 | free_here(a); 49 | exit(1); 50 | } 51 | } 52 | 53 | int grab_command(t_nums **a, t_nums **b) 54 | { 55 | char *line; 56 | 57 | while (get_next_line(0, &line) > 0) 58 | { 59 | apply_command(line, a, b); 60 | free(line); 61 | } 62 | if (*b != NULL) 63 | { 64 | ft_putstr("\33[31mKO\033[0m\n"); 65 | free_here(a); 66 | free_here(b); 67 | exit(1); 68 | } 69 | if (final_confirmed_ordered(*a, *b) == 0) 70 | ft_putstr("\033[32mOK\033[0m\n"); 71 | else 72 | ft_putstr("\033[31mKO\033[0m\n"); 73 | return (0); 74 | } 75 | -------------------------------------------------------------------------------- /send_entire_b_to_a.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* send_entire_b_to_a.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/11/03 18:35:12 by jadawson #+# #+# */ 9 | /* Updated: 2018/11/06 16:02:19 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | int rb_or_rrb_one_hun_two(t_nums **a, t_nums **b, int pos, int tot) 16 | { 17 | int i; 18 | int biggest; 19 | 20 | i = 0; 21 | biggest = biggest_finder(*b); 22 | while (tot > pos) 23 | { 24 | reverse_rotate_b(b); 25 | write(1, "rrb\n", 4); 26 | pos++; 27 | i++; 28 | } 29 | if ((*b)->num == biggest) 30 | { 31 | push_a(a, b); 32 | write(1, "pa\n", 3); 33 | } 34 | return (i); 35 | } 36 | 37 | int rb_or_rrb_one_hun_one(t_nums **a, t_nums **b, int pos, int i) 38 | { 39 | while (pos > 0) 40 | { 41 | rotate_b(b); 42 | write(1, "rb\n", 3); 43 | pos--; 44 | i++; 45 | } 46 | if (pos == 0) 47 | { 48 | push_a(a, b); 49 | write(1, "pa\n", 3); 50 | i++; 51 | } 52 | return (i); 53 | } 54 | 55 | int rb_or_rrb_one_hundered(t_nums **a, t_nums **b, int tot) 56 | { 57 | int i; 58 | int half; 59 | int pos; 60 | int biggest; 61 | 62 | i = 0; 63 | while (*b) 64 | { 65 | tot = tot_value(*b); 66 | half = tot / 2; 67 | pos = 0; 68 | biggest = biggest_finder(*b); 69 | pos = pos_finder(*b, pos, biggest); 70 | if (pos <= half) 71 | i += rb_or_rrb_one_hun_one(a, b, pos, i); 72 | if (pos > half) 73 | i += rb_or_rrb_one_hun_two(a, b, pos, tot); 74 | } 75 | return (i); 76 | } 77 | -------------------------------------------------------------------------------- /alg_file.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* alg_file.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/09/11 19:35:19 by jadawson #+# #+# */ 9 | /* Updated: 2018/11/03 18:55:43 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | int push_and_find(t_nums **a, t_nums **b, int small) 16 | { 17 | push_b(a, b); 18 | write(1, "pb\n", 3); 19 | if (*a) 20 | small = min_finder(*a, small); 21 | return (small); 22 | } 23 | 24 | int push_and_i(t_nums **a, t_nums **b) 25 | { 26 | int i; 27 | 28 | i = 0; 29 | while (*b) 30 | { 31 | push_a(a, b); 32 | write(1, "pa\n", 3); 33 | i++; 34 | } 35 | return (i); 36 | } 37 | 38 | int ra_or_rra_two(t_nums **a, int tot_minus_pos, int i) 39 | { 40 | while (tot_minus_pos > 0) 41 | { 42 | reverse_rotate_a(a); 43 | write(1, "rra\n", 4); 44 | tot_minus_pos--; 45 | i++; 46 | } 47 | return (i); 48 | } 49 | 50 | int ra_or_rra(t_nums **a, int tot, int pos) 51 | { 52 | int i; 53 | int half; 54 | int tot_minus_pos; 55 | 56 | i = 0; 57 | half = tot / 2; 58 | tot_minus_pos = tot - pos; 59 | if (pos <= half) 60 | { 61 | while (pos > 0) 62 | { 63 | rotate_a(a); 64 | write(1, "ra\n", 3); 65 | pos--; 66 | i++; 67 | } 68 | } 69 | if (pos > half) 70 | i += ra_or_rra_two(a, tot_minus_pos, i); 71 | return (i); 72 | } 73 | 74 | int pos_finder(t_nums *a, int pos, int small) 75 | { 76 | int i; 77 | 78 | i = -1; 79 | while (a) 80 | { 81 | i++; 82 | if (small == a->num) 83 | pos = i; 84 | a = a->next; 85 | } 86 | return (pos); 87 | } 88 | -------------------------------------------------------------------------------- /jumbo_list.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* jumbo_list.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/11/06 15:45:44 by jadawson #+# #+# */ 9 | /* Updated: 2018/11/06 15:59:33 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | int j_handle_while_range(t_nums **a, t_nums **b, int range_pos, int chunk) 16 | { 17 | int tot; 18 | int local_max; 19 | int i; 20 | int pos; 21 | 22 | tot = tot_value(*a); 23 | local_max = tot / 20; 24 | i = 0; 25 | pos = 0; 26 | while (range(*a, chunk) == 1) 27 | { 28 | range_pos = range_pos_funct(*a, local_max); 29 | if ((*a) && !((*a)->num <= chunk)) 30 | i += a_which_x_amount(a, range_pos); 31 | if ((*a) && (*a)->num <= chunk) 32 | { 33 | if (tot_b(*b) == 1 || (!*b)) 34 | i += b_empty_or_one(a, b); 35 | } 36 | if (tot_b(*b) > 1 && (*a) && (*a)->num <= chunk) 37 | i += sort_b_big_or_small(a, b); 38 | if (tot_b(*b) > 1 && (*a) && (*a)->num <= chunk) 39 | i += before_push_b(a, b); 40 | } 41 | return (i); 42 | } 43 | 44 | int jumbo(t_nums **a, t_nums **b, int i) 45 | { 46 | int local_max; 47 | int tot; 48 | int j; 49 | int tot_div_chunk; 50 | int range_pos; 51 | 52 | j = 0; 53 | tot = tot_value(*a); 54 | while (*a) 55 | { 56 | j++; 57 | local_max = tot / 20; 58 | tot_div_chunk = local_max * j; 59 | range_pos = range_pos_funct(*a, local_max); 60 | if (range(*a, tot_div_chunk) == 1) 61 | i += j_handle_while_range(a, b, range_pos, tot_div_chunk); 62 | } 63 | if (!*a) 64 | i += rb_or_rrb_one_hundered(a, b, tot); 65 | return (i); 66 | } 67 | -------------------------------------------------------------------------------- /libft/Makefile: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: jadawson +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2018/03/03 23:56:36 by jadawson #+# #+# # 9 | # Updated: 2018/09/25 20:13:59 by jadawson ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | CC = gcc 14 | CFLAGS = -Wall -Wextra -Werror -g -c 15 | 16 | NAME = libft.a 17 | 18 | SOURCES = ft_putchar_fd.c ft_strcmp.c ft_strlen.c ft_strrchr.c ft_atoi.c \ 19 | ft_memccpy.c ft_putendl.c ft_strcpy.c ft_strmap.c ft_strsplit.c \ 20 | ft_bzero.c ft_memchr.c ft_putnbr.c ft_strdel.c ft_strmapi.c \ 21 | ft_strstr.c ft_isalnum.c ft_memcmp.c ft_putnbr_fd.c ft_strdup.c \ 22 | ft_strncat.c ft_strsub.c ft_isalpha.c ft_memcpy.c ft_putstr.c \ 23 | ft_strequ.c ft_strncmp.c ft_strtrim.c ft_isascii.c ft_memdel.c \ 24 | ft_putstr_fd.c ft_striter.c ft_strncpy.c ft_tolower.c ft_isdigit.c \ 25 | ft_memmove.c ft_strcat.c ft_striteri.c ft_strnequ.c ft_toupper.c \ 26 | ft_isprint.c ft_memset.c ft_strchr.c ft_strjoin.c ft_strnew.c \ 27 | ft_itoa.c ft_putchar.c ft_strclr.c ft_strlcat.c ft_strnstr.c \ 28 | ft_memalloc.c ft_putendl_fd.c ft_count_words.c ft_numlen.c ft_lstnew.c \ 29 | ft_lstdelone.c ft_lstdel.c ft_lstadd.c ft_lstiter.c ft_lstmap.c ft_swap.c \ 30 | ft_strrev.c ft_is_prime.c 31 | 32 | OBJECTS = $(SOURCES:%.c=%.o) 33 | 34 | all: $(NAME) 35 | 36 | $(NAME): 37 | $(CC) $(CFLAGS) $(SOURCES) 38 | ar rc $(NAME) $(OBJECTS) 39 | 40 | clean: 41 | rm -f $(OBJECTS) 42 | 43 | fclean: clean 44 | rm -f $(NAME) 45 | 46 | re: fclean all 47 | -------------------------------------------------------------------------------- /bulky_large.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* bulky_large.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/11/06 15:19:09 by jadawson #+# #+# */ 9 | /* Updated: 2018/11/12 18:49:40 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | int before_push_b_five(t_nums **a, t_nums **b) 16 | { 17 | int i; 18 | int pos; 19 | 20 | i = 0; 21 | pos = pos_for_b(a, b); 22 | i += which_x_amount(b, pos); 23 | i += push_b_and_write(a, b); 24 | return (i); 25 | } 26 | 27 | int bl_handle_while_range(t_nums **a, t_nums **b, int range_p, int chunk) 28 | { 29 | int tot; 30 | int local_max; 31 | int i; 32 | int pos; 33 | 34 | tot = tot_value(*a); 35 | local_max = tot / 11; 36 | i = 0; 37 | pos = 0; 38 | while (range(*a, chunk) == 1) 39 | { 40 | range_p = range_pos_funct(*a, local_max); 41 | if ((*a) && !((*a)->num <= chunk)) 42 | i += a_which_x_amount(a, range_p); 43 | if ((*a) && (*a)->num <= chunk) 44 | { 45 | if (tot_b(*b) == 1 || (!*b)) 46 | i += b_empty_or_one(a, b); 47 | } 48 | if (tot_b(*b) > 1 && (*a) && (*a)->num <= chunk) 49 | i += sort_b_big_or_small(a, b); 50 | if (tot_b(*b) > 1 && (*a) && (*a)->num <= chunk) 51 | i += before_push_b_five(a, b); 52 | } 53 | return (i); 54 | } 55 | 56 | int bulky_large(t_nums **a, t_nums **b, int i) 57 | { 58 | int local_max; 59 | int tot; 60 | int j; 61 | int tot_div_chunk; 62 | int range_pos; 63 | 64 | j = 0; 65 | tot = tot_value(*a); 66 | while (*a) 67 | { 68 | j++; 69 | local_max = tot / 11; 70 | tot_div_chunk = local_max * j; 71 | range_pos = range_pos_funct(*a, local_max); 72 | if (range(*a, tot_div_chunk) == 1) 73 | i += bl_handle_while_range(a, b, range_pos, tot_div_chunk); 74 | } 75 | if (!*a) 76 | i += rb_or_rrb_one_hundered(a, b, tot); 77 | return (i); 78 | } 79 | -------------------------------------------------------------------------------- /bulky_med.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* bulky_med.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/11/06 15:05:06 by jadawson #+# #+# */ 9 | /* Updated: 2018/11/06 15:25:07 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | int range_pos_funct(t_nums *a, int local_max) 16 | { 17 | int pos_num; 18 | int i; 19 | 20 | pos_num = 0; 21 | i = -1; 22 | while (a) 23 | { 24 | i++; 25 | if (a->num <= local_max) 26 | { 27 | return (i); 28 | } 29 | a = a->next; 30 | } 31 | return (i); 32 | } 33 | 34 | int before_push_b(t_nums **a, t_nums **b) 35 | { 36 | int pos; 37 | int i; 38 | 39 | i = 0; 40 | pos = pos_for_b(a, b); 41 | i += which_x_amount(b, pos); 42 | i += push_b_and_write(a, b); 43 | return (i); 44 | } 45 | 46 | int a_handle_while_range(t_nums **a, t_nums **b, int range_pos, int chunk) 47 | { 48 | int tot; 49 | int local_max; 50 | int i; 51 | int pos; 52 | 53 | tot = tot_value(*a); 54 | local_max = tot / 5; 55 | i = 0; 56 | pos = 0; 57 | while (range(*a, chunk) == 1) 58 | { 59 | range_pos = range_pos_funct(*a, local_max); 60 | if ((*a) && !((*a)->num <= chunk)) 61 | i += a_which_x_amount(a, range_pos); 62 | if ((*a) && (*a)->num <= chunk) 63 | { 64 | if (tot_b(*b) == 1 || (!*b)) 65 | i += b_empty_or_one(a, b); 66 | } 67 | if (tot_b(*b) > 1 && (*a) && (*a)->num <= chunk) 68 | i += sort_b_big_or_small(a, b); 69 | if (tot_b(*b) > 1 && (*a) && (*a)->num <= chunk) 70 | i += before_push_b(a, b); 71 | } 72 | return (i); 73 | } 74 | 75 | int bulky_med(t_nums **a, t_nums **b, int i) 76 | { 77 | int local_max; 78 | int tot; 79 | int j; 80 | int tot_div_chunk; 81 | int range_pos; 82 | 83 | j = 0; 84 | tot = tot_value(*a); 85 | while (*a) 86 | { 87 | j++; 88 | local_max = tot / 5; 89 | tot_div_chunk = local_max * j; 90 | range_pos = range_pos_funct(*a, local_max); 91 | if (range(*a, tot_div_chunk) == 1) 92 | i += a_handle_while_range(a, b, range_pos, tot_div_chunk); 93 | } 94 | if (!*a) 95 | i += rb_or_rrb_one_hundered(a, b, tot); 96 | return (i); 97 | } 98 | -------------------------------------------------------------------------------- /is_b_ordered.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* is_b_ordered.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/09/30 21:18:54 by jadawson #+# #+# */ 9 | /* Updated: 2018/10/30 14:53:27 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | int sort_b_big_or_small(t_nums **a, t_nums **b) 16 | { 17 | long b_largest; 18 | long b_smallest; 19 | int b_small_pos; 20 | int i; 21 | 22 | i = 0; 23 | b_largest = biggest_finder(*b); 24 | b_smallest = smallest_finder(*b); 25 | b_small_pos = b_small_pos_funct(*b, b_smallest); 26 | if ((*a)->num < b_smallest || (*a)->num > b_largest) 27 | { 28 | i += which_x_amount(b, b_small_pos); 29 | i += push_b_and_write(a, b); 30 | } 31 | return (i); 32 | } 33 | 34 | int pos_for_b(t_nums **a, t_nums **b) 35 | { 36 | int i; 37 | t_nums *temp; 38 | int pos; 39 | 40 | i = 0; 41 | pos = 0; 42 | temp = *b; 43 | if (a) 44 | { 45 | while (temp) 46 | { 47 | pos++; 48 | if (temp->next != NULL) 49 | { 50 | if ((*a)->num > temp->num && (*a)->num < temp->next->num) 51 | return (pos); 52 | } 53 | temp = temp->next; 54 | } 55 | } 56 | return (pos); 57 | } 58 | 59 | int rb_x_amount(t_nums **b, int pos) 60 | { 61 | int i; 62 | int tot; 63 | 64 | i = pos; 65 | tot = tot_b(*b); 66 | while (pos != 0) 67 | { 68 | rotate_b(b); 69 | write(1, "rb\n", 3); 70 | pos--; 71 | } 72 | return (i); 73 | } 74 | 75 | int rrb_x_amount(t_nums **b, int pos) 76 | { 77 | int i; 78 | int tot; 79 | 80 | tot = tot_b(*b); 81 | pos = tot - pos; 82 | i = pos; 83 | if (pos > 0) 84 | { 85 | while (pos != 0) 86 | { 87 | reverse_rotate_b(b); 88 | write(1, "rrb\n", 4); 89 | pos--; 90 | } 91 | } 92 | return (i); 93 | } 94 | 95 | int which_x_amount(t_nums **b, int pos) 96 | { 97 | int tot; 98 | int i; 99 | 100 | tot = 0; 101 | tot = tot_value(*b); 102 | i = 0; 103 | if (pos < tot / 2) 104 | i += rb_x_amount(b, pos); 105 | if (pos >= tot / 2) 106 | i += rrb_x_amount(b, pos); 107 | return (i); 108 | } 109 | -------------------------------------------------------------------------------- /sort_five.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* sort_five.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/10/29 14:55:22 by jadawson #+# #+# */ 9 | /* Updated: 2018/11/01 20:17:42 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | int five_pb_first_nums(t_nums **a, t_nums **b, int i) 16 | { 17 | i = 2; 18 | push_b(a, b); 19 | push_b(a, b); 20 | write(1, "pb\n", 3); 21 | write(1, "pb\n", 3); 22 | return (i); 23 | } 24 | 25 | int sort_a_big_or_small(t_nums **a, t_nums **b) 26 | { 27 | long b_largest; 28 | long b_smallest; 29 | int b_small_pos; 30 | int i; 31 | 32 | i = 0; 33 | b_largest = biggest_finder(*b); 34 | b_smallest = smallest_finder(*b); 35 | b_small_pos = b_small_pos_funct(*b, b_smallest); 36 | if ((*a)->num < b_smallest || (*a)->num > b_largest) 37 | i += a_which_x_amount(b, b_small_pos); 38 | return (i); 39 | } 40 | 41 | int pos_for_a(t_nums **a, t_nums **b, int pos) 42 | { 43 | int i; 44 | t_nums *temp; 45 | 46 | i = 0; 47 | temp = *a; 48 | if (*b) 49 | { 50 | if ((*b)->num > biggest_finder(*a) || (*b)->num < smallest_finder(*a)) 51 | sort_a_big_or_small(b, a); 52 | else 53 | { 54 | while (temp) 55 | { 56 | pos++; 57 | if (temp->next != NULL) 58 | { 59 | if ((*b)->num > temp->num && (*b)->num < temp->next->num) 60 | return (pos); 61 | } 62 | temp = temp->next; 63 | } 64 | } 65 | } 66 | return (pos); 67 | } 68 | 69 | int pos_finder_test(t_nums *a, int small) 70 | { 71 | int i; 72 | int pos; 73 | 74 | i = 0; 75 | pos = 0; 76 | while (a) 77 | { 78 | if (small == a->num) 79 | pos = i; 80 | i++; 81 | a = a->next; 82 | } 83 | return (pos); 84 | } 85 | 86 | int sort_five(t_nums **a, t_nums **b, int i) 87 | { 88 | int pos; 89 | int small; 90 | 91 | pos = 0; 92 | small = 0; 93 | i += five_pb_first_nums(a, b, i); 94 | i += sort_three(a); 95 | while (*b) 96 | { 97 | pos = 0; 98 | pos = pos_for_a(a, b, pos); 99 | i += a_which_x_amount(a, pos); 100 | push_a(a, b); 101 | write(1, "pa\n", 3); 102 | } 103 | small = smallest_finder(*a); 104 | pos = pos_finder_test(*a, small); 105 | i += a_which_x_amount(a, pos); 106 | return (i); 107 | } 108 | -------------------------------------------------------------------------------- /gnl/get_next_line.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* get_next_line.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/04/10 16:06:34 by jadawson #+# #+# */ 9 | /* Updated: 2018/11/10 20:42:20 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "get_next_line.h" 14 | 15 | char *connect(char *str, char *holder) 16 | { 17 | char *strptr; 18 | 19 | strptr = ft_strjoin(str, holder); 20 | free(str); 21 | return (strptr); 22 | } 23 | 24 | int the_end(char **line, char **strings, char **holder) 25 | { 26 | if (ft_strlen(strings[0]) != 0) 27 | { 28 | *line = strings[0]; 29 | free(*holder); 30 | *holder = ft_strnew(0); 31 | return (1); 32 | } 33 | free(*holder); 34 | free(strings[0]); 35 | strings[0] = NULL; 36 | *holder = NULL; 37 | return (0); 38 | } 39 | 40 | int looping(int fd, char **strings, char **holder, char **line) 41 | { 42 | int ret; 43 | char buf[BUFF_SIZE + 1]; 44 | 45 | while (1) 46 | { 47 | ret = read(fd, &buf, BUFF_SIZE); 48 | if (ret < 0) 49 | return (-1); 50 | if (ret == 0) 51 | return (the_end(line, strings, holder)); 52 | buf[ret] = '\0'; 53 | strings[1] = ft_strchr(buf, '\n'); 54 | if (strings[1] != NULL) 55 | { 56 | *strings[1] = '\0'; 57 | strings[0] = connect(strings[0], buf); 58 | *strings[1] = '\n'; 59 | *holder = connect(*holder, strings[1] + 1); 60 | *line = strings[0]; 61 | return (1); 62 | } 63 | strings[0] = connect(strings[0], buf); 64 | } 65 | } 66 | 67 | void holder_test(char **strings, char **holder) 68 | { 69 | if (*holder[0] != '\n') 70 | strings[0] = connect(strings[0], *holder); 71 | else 72 | free(strings[0]); 73 | } 74 | 75 | int get_next_line(const int fd, char **line) 76 | { 77 | char *strings[3]; 78 | static char *holder; 79 | 80 | strings[0] = ft_strnew(0); 81 | if (holder == NULL) 82 | holder = ft_strnew(0); 83 | if (fd < 0 || !line || BUFF_SIZE < 0) 84 | return (-1); 85 | strings[1] = ft_strchr(holder, '\n'); 86 | if (strings[1] != NULL) 87 | { 88 | *strings[1] = '\0'; 89 | *line = ft_strdup(holder); 90 | *strings[1] = '\n'; 91 | strings[2] = ft_strdup(strings[1] + 1); 92 | free(holder); 93 | holder = strings[2]; 94 | free(strings[0]); 95 | return (1); 96 | } 97 | holder_test(strings, &holder); 98 | free(holder); 99 | holder = ft_strnew(0); 100 | return (looping(fd, strings, &holder, line)); 101 | } 102 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: jadawson +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2018/09/05 18:40:48 by jadawson #+# #+# # 9 | # Updated: 2018/11/13 16:47:42 by jadawson ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | CC = gcc 14 | 15 | CFLAGS = -Wall -Wextra -Werror 16 | 17 | CHECKER_NAME = checker 18 | 19 | PUSH_SWAP_NAME = push_swap 20 | 21 | LIBFT = libft/libft.a 22 | 23 | CHECKER_HEADER = check_header.h 24 | 25 | GNL_HEADER = gnl/get_next_line.h 26 | 27 | GNL_C = gnl/get_next_line.c 28 | 29 | CHECKER_SOURCES = checker.c sa.c sb.c ss.c pa.c pb.c ra.c rb.c rr.c \ 30 | rra.c rrb.c rrr.c grab_command.c find_command.c \ 31 | first_confirmed_ordered.c final_confirmed_ordered.c \ 32 | min_finder.c alg_file.c str_n_file.c free_here.c \ 33 | confirming_digits.c 34 | 35 | PUSH_SWAP_SOURCES = push_swap.c sa.c sb.c ss.c pa.c pb.c ra.c rb.c \ 36 | rr.c rra.c rrb.c rrr.c grab_command.c find_command.c \ 37 | first_confirmed_ordered.c final_confirmed_ordered.c \ 38 | min_finder.c alg_file.c sort_three.c \ 39 | sort_three_solutions.c my_insert_sort.c \ 40 | confirming_digits.c range.c\ 41 | is_b_ordered.c smallest_finder.c \ 42 | biggest_finder.c tot_b.c send_entire_b_to_a.c \ 43 | b_helper_functs.c helper_ra_rra.c sort_five.c \ 44 | str_n_file.c bulky_med.c bulky_large.c jumbo_list.c \ 45 | free_here.c 46 | 47 | all: $(CHECKER_NAME) 48 | 49 | $(CHECKER_NAME): 50 | @echo "\033[33mcreating the checker executable!\033[0m" 51 | @$(CC) $(CFLAGS) -I $(CHECKER_HEADER) \ 52 | -I $(GNL_HEADER) $(GNL_C) $(LIBFT) $(CHECKER_SOURCES) -o $(CHECKER_NAME) 53 | @echo "\033[33mcreating the push_swap executable!\033[0m" 54 | @$(CC) $(CFLAGS) -I $(CHECKER_HEADER) \ 55 | -I $(GNL_HEADER) $(GNL_C) $(LIBFT) $(PUSH_SWAP_SOURCES) -o $(PUSH_SWAP_NAME) 56 | 57 | clean: 58 | @echo "\033[31mObjects cleaned!\033[0m" 59 | @rm -f $(OBJECTS) 60 | 61 | fclean: clean 62 | @echo "\033[31mExecutables cleaned!\033[0m" 63 | @rm -f $(CHECKER_NAME) 64 | @rm -f $(PUSH_SWAP_NAME) 65 | 66 | re: fclean all 67 | 68 | checker_leaks: 69 | @echo "\033[32mYou can now test checker in lldb\033[0m" 70 | @$(CC) $(CFLAGS) -I $(CHECKER_HEADER) -o checker -g -fsanitize=address -I \ 71 | $(GNL_HEADER) $(GNL_C) $(LIBFT) $(CHECKER_SOURCES) 72 | push_leaks: 73 | @echo "\033[32mYou can now test push_swap in lldb\033[0m" 74 | @$(CC) $(CFLAGS) -I $(CHECKER_HEADER) -o push_swap -g -fsanitize=address -I \ 75 | $(GNL_HEADER) $(GNL_C) $(LIBFT) $(PUSH_SWAP_SOURCES) 76 | -------------------------------------------------------------------------------- /confirming_digits.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* confirming_digits.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/09/24 20:54:25 by jadawson #+# #+# */ 9 | /* Updated: 2018/11/13 16:53:52 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | void exit_not_a_num(t_nums **a) 16 | { 17 | ft_putstr("\033[31mError\033[0m\n"); 18 | free_here(a); 19 | exit(1); 20 | } 21 | 22 | void above_int_max_c(long long nbr, t_nums **a) 23 | { 24 | long long int i; 25 | long long int small; 26 | 27 | i = 1; 28 | small = -2147483648; 29 | if (nbr > 2147483647) 30 | { 31 | ft_putstr("\33[31mError\033[0m\n"); 32 | free_here(a); 33 | exit(1); 34 | } 35 | if (nbr < small) 36 | { 37 | ft_putstr("\33[31mError\033[0m\n"); 38 | free_here(a); 39 | exit(1); 40 | } 41 | } 42 | 43 | long long ft_atoi_digit_confirm_c(const char *str, t_nums **a) 44 | { 45 | long long i; 46 | long long nbr; 47 | int negative; 48 | 49 | nbr = 0; 50 | negative = 1; 51 | i = 0; 52 | while (is_space(str[i])) 53 | i++; 54 | if (str[i] == '-') 55 | negative = -1; 56 | if (str[i] == '+' || str[i] == '-') 57 | i++; 58 | while ((str[i] >= '0') && (str[i] <= '9')) 59 | { 60 | nbr = (nbr * 10) + (str[i] - '0'); 61 | i++; 62 | } 63 | if (str[i] != '\0' && !(str[i] >= '0' && str[i] <= '9')) 64 | exit_not_a_num(a); 65 | above_int_max_c(nbr * negative, a); 66 | return (nbr * negative); 67 | } 68 | 69 | void above_int_max(long long nbr, t_nums **a) 70 | { 71 | long long int i; 72 | long long int small; 73 | 74 | i = 1; 75 | small = -2147483648; 76 | if (nbr > 2147483647) 77 | { 78 | ft_putstr("\33[31mError\033[0m\n"); 79 | free_here(a); 80 | exit(1); 81 | } 82 | if (nbr < small) 83 | { 84 | ft_putstr("\33[31mError\033[0m\n"); 85 | free_here(a); 86 | exit(1); 87 | } 88 | } 89 | 90 | long long ft_atoi_digit_confirm(const char *str, t_nums **a) 91 | { 92 | long long i; 93 | long long nbr; 94 | int negative; 95 | 96 | nbr = 0; 97 | negative = 1; 98 | i = 0; 99 | while (is_space(str[i])) 100 | i++; 101 | if (str[i] == '-') 102 | negative = -1; 103 | if (str[i] == '+' || str[i] == '-') 104 | i++; 105 | while ((str[i] >= '0') && (str[i] <= '9')) 106 | { 107 | nbr = (nbr * 10) + (str[i] - '0'); 108 | i++; 109 | } 110 | if (str[i] != '\0' && !(str[i] >= '0' && str[i] <= '9')) 111 | exit_not_a_num(a); 112 | above_int_max(nbr * negative, a); 113 | return (nbr * negative); 114 | } 115 | -------------------------------------------------------------------------------- /push_swap.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* push_swap.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/09/18 20:11:05 by jadawson #+# #+# */ 9 | /* Updated: 2018/11/13 16:49:15 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "check_header.h" 14 | 15 | int bulky_list(t_nums **a, t_nums **b, int i, int numbers) 16 | { 17 | if (numbers <= 200) 18 | { 19 | i += bulky_med(a, b, i); 20 | return (i); 21 | } 22 | if (numbers <= 800) 23 | { 24 | i += bulky_large(a, b, i); 25 | return (i); 26 | } 27 | return (i); 28 | } 29 | 30 | int three_or_five(t_nums **a, t_nums **b, int flag, int argc) 31 | { 32 | int i; 33 | 34 | i = 0; 35 | if (argc == 4 && flag == 0) 36 | i += sort_three(a); 37 | if (argc == 6 && flag == 0) 38 | i += sort_five(a, b, i); 39 | if (argc == 5 && flag == 1) 40 | i += sort_three(a); 41 | if (argc == 7 && flag == 1) 42 | i += sort_five(a, b, i); 43 | return (i); 44 | } 45 | 46 | t_nums *create_a_list_ps(int argc, char **argv, t_nums **a) 47 | { 48 | t_nums *hold_head; 49 | t_nums *head; 50 | t_nums *temp; 51 | int i; 52 | 53 | i = 2; 54 | i = (argv[1][0] == '-' && argv[1][1] == 'j') ? 3 : 2; 55 | head = malloc(sizeof(t_nums)); 56 | hold_head = head; 57 | if (argv[1][0] == '-' && argv[1][1] == 'j') 58 | head->num = ft_atoi_digit_confirm(argv[2], a); 59 | else 60 | head->num = ft_atoi_digit_confirm(argv[1], a); 61 | head->next = NULL; 62 | while (i < argc) 63 | { 64 | temp = malloc(sizeof(t_nums)); 65 | temp->num = ft_atoi_digit_confirm(argv[i], a); 66 | temp->next = NULL; 67 | hold_head->next = temp; 68 | hold_head = hold_head->next; 69 | dup_check_ps(head, temp->num, a); 70 | i++; 71 | } 72 | return (head); 73 | } 74 | 75 | void print_list_ps(t_nums *nums) 76 | { 77 | while (nums != NULL) 78 | { 79 | ft_putnbr(nums->num); 80 | ft_putstr("\n"); 81 | nums = nums->next; 82 | } 83 | } 84 | 85 | int main(int argc, char **argv) 86 | { 87 | t_nums *a; 88 | t_nums *b; 89 | int i; 90 | int flag; 91 | 92 | i = 0; 93 | flag = 0; 94 | a = NULL; 95 | flag = (argv[1][0] == '-' && argv[1][1] == 'j') ? 1 : 0; 96 | a = create_a_list_ps(argc, argv, &a); 97 | b = NULL; 98 | if (a == NULL || first_confirmed_ordered(a) == 0) 99 | return (0); 100 | if (argc >= 4 && argc <= 7) 101 | i += three_or_five(&a, &b, flag, argc); 102 | if (argc >= 8 && argc <= 800) 103 | i += bulky_list(&a, &b, i, argc); 104 | if (argc >= 801) 105 | jumbo(&a, &b, i); 106 | if (final_confirmed_ordered(a, b) == 1) 107 | i = my_insert_sort(&a, &b, i); 108 | if (flag == 1) 109 | print_list_ps(a); 110 | free_a_and_b(&a, &b); 111 | return (0); 112 | } 113 | -------------------------------------------------------------------------------- /libft/libft.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* libft.h :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/02/19 18:28:21 by jadawson #+# #+# */ 9 | /* Updated: 2018/09/10 00:27:06 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #ifndef LIBFT_H 14 | # define LIBFT_H 15 | # include 16 | # include 17 | # include 18 | # include 19 | 20 | typedef struct s_list 21 | { 22 | void *content; 23 | size_t content_size; 24 | struct s_list *next; 25 | } t_list; 26 | 27 | long long ft_atoi(const char *str); 28 | void ft_bzero(void *s, size_t n); 29 | int ft_isalnum(int c); 30 | int ft_isalpha(int c); 31 | int ft_isascii(int c); 32 | int ft_isdigit(int c); 33 | int ft_isprint(int c); 34 | void *ft_memalloc(size_t size); 35 | void *ft_memccpy(void *dst, const void *src, int c, size_t n); 36 | void *ft_memchr(const void *s, int c, size_t n); 37 | int ft_memcmp(const void *s1, const void *s2, size_t n); 38 | void *ft_memcpy(void *dst, const void *src, size_t n); 39 | void ft_memdel(void **ap); 40 | void *ft_memmove(void *dest, const void *src, size_t n); 41 | void *ft_memset(void *ptr, int value, size_t num); 42 | void ft_putchar(char c); 43 | void ft_putchar_fd(char c, int fd); 44 | void ft_putendl(char *s); 45 | void ft_putnbr(int nb); 46 | void ft_putnbr_fd(int n, int fd); 47 | void ft_putstr(char const *s); 48 | void ft_putstr_fd(char const *s, int fd); 49 | char *ft_strcat(char *s1, const char *s2); 50 | char *ft_strchr(const char *s, int c); 51 | void ft_strclr(char *s); 52 | int ft_strcmp(const char *s1, const char *s2); 53 | char *ft_strcpy(char *dest, char *src); 54 | void ft_strdel(char **as); 55 | char *ft_strdup(char *src); 56 | int ft_strequ(char const *s1, char const *s2); 57 | void ft_striter(char *s, void (*f)(char *)); 58 | void ft_striteri(char *s, void (*f)(unsigned int, char *)); 59 | char *ft_strjoin(char const *s1, char const *s2); 60 | size_t ft_strlcat(char *dest, const char *src, size_t num); 61 | size_t ft_strlen(const char *str); 62 | char *ft_strmap(char const *s, char (*f)(char)); 63 | char *ft_strmapi(char const *s, char (*f)(unsigned int, char)); 64 | char *ft_strncat(char *dest, const char *src, size_t num); 65 | int ft_strncmp(const char *s1, const char *s2, size_t n); 66 | char *ft_strncpy(char *dest, const char *src, size_t n); 67 | int ft_strnequ(const char *s1, const char *s2, size_t n); 68 | char *ft_strnew(size_t size); 69 | char *ft_strnstr(const char *big, const char *l, size_t len); 70 | char *ft_strrchr(const char *s, int c); 71 | char **ft_strsplit(char *str, char c); 72 | char *ft_strstr(const char *str, const char *to_find); 73 | char *ft_strsub(char const *s, unsigned int start, size_t len); 74 | char *ft_strtrim(char const *s); 75 | int ft_tolower(int c); 76 | int ft_strncmp(const char *s1, const char *s2, size_t n); 77 | void ft_putendl_fd(char const *s, int fd); 78 | int ft_toupper(int c); 79 | char *ft_itoa(int i); 80 | int ft_count_words(char *str, char c); 81 | int ft_numlen(int x); 82 | t_list *ft_lstnew(void const *content, size_t content_size); 83 | void ft_lstdelone(t_list **alst, void (*del)(void *, size_t)); 84 | void ft_lstdel(t_list **alst, void (*del)(void *, size_t)); 85 | void ft_lstadd(t_list **alst, t_list *new); 86 | void ft_lstiter(t_list *lst, void (*f)(t_list *elem)); 87 | t_list *ft_lstmap(t_list *lst, t_list *(*f)(t_list *elem)); 88 | void ft_swap(int *a, int *b); 89 | char *ft_strrev(char *str); 90 | int ft_is_prime(int nb); 91 | #endif 92 | -------------------------------------------------------------------------------- /check_header.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* check_header.h :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jadawson +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2018/08/24 14:36:53 by jadawson #+# #+# */ 9 | /* Updated: 2018/11/13 16:50:35 by jadawson ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #ifndef CHECK_HEADER_H 14 | # define CHECK_HEADER_H 15 | # include "libft/libft.h" 16 | # include "gnl/get_next_line.h" 17 | # include 18 | # include 19 | # include 20 | # include 21 | 22 | typedef struct s_nums{ 23 | long num; 24 | struct s_nums *next; 25 | } t_nums; 26 | 27 | void free_a_and_b(t_nums **a, t_nums **b); 28 | void above_int_max(long long nbr, t_nums **a); 29 | long long ft_atoi_digit_confirm(const char *str, t_nums **a); 30 | void above_int_max_c(long long nbr, t_nums **a); 31 | long long ft_atoi_digit_confirm_c(const char *str, t_nums **a); 32 | int is_space(char c); 33 | void dup_check_ps(t_nums *head, int nbr, t_nums **a); 34 | void dup_check_c(t_nums *head, int nbr, t_nums **a); 35 | t_nums *create_a_list_ps(int argc, char **argv, t_nums **a); 36 | t_nums *create_a_list_c(int argc, char **argv, t_nums **a); 37 | void confirm_digit(int argc, char **argv); 38 | void free_here(t_nums **all); 39 | int before_push_b(t_nums **a, t_nums **b); 40 | void print_list(t_nums *nums); 41 | int sort_five(t_nums **a, t_nums **b, int i); 42 | int five_pb_first_nums(t_nums **a, t_nums **b, int i); 43 | char **str_n(int argc, char **argv); 44 | int rb_or_rrb_one_hun_one(t_nums **a, t_nums **b, int pos, int i); 45 | int ra_x_amount(t_nums **a, int pos); 46 | int rra_x_amount(t_nums **a, int pos); 47 | int a_which_x_amount(t_nums **a, int range_pos); 48 | int b_small_pos_funct(t_nums *b, int b_smallest); 49 | void print_list(t_nums *nums); 50 | int a_which_x_amount(t_nums **a, int pos); 51 | int rrb_x_amount(t_nums **b, int pos); 52 | int rb_x_amount(t_nums **b, int pos); 53 | int which_x_amount(t_nums **b, int pos); 54 | int b_empty_or_one(t_nums **a, t_nums **b); 55 | int bulky_large(t_nums **a, t_nums **b, int i); 56 | int range_pos_funct(t_nums *a, int local_max); 57 | int pos_for_b(t_nums **a, t_nums **b); 58 | int bulky_med(t_nums **a, t_nums **b, int i); 59 | int bulky_list(t_nums **a, t_nums **b, int i, int numbers); 60 | int jumbo(t_nums **a, t_nums **b, int i); 61 | int is_b_ordered(t_nums *b); 62 | int is_a_empty(t_nums *a); 63 | long biggest_finder(t_nums *a); 64 | long smallest_finder(t_nums *b); 65 | int sort_b_big_or_small(t_nums **a, t_nums **b); 66 | int range(t_nums *a, int local_max); 67 | int bottom_b_value(t_nums *b); 68 | int tot_b(t_nums *b); 69 | int pa_final(t_nums **a, t_nums **b); 70 | int large_to_top_of_b(t_nums **a, t_nums **b); 71 | int b_largest_location(t_nums *b, long b_largest); 72 | int rb_or_rrb_one_hundered(t_nums **a, t_nums **b, int tot); 73 | int rb_or_rrb_one_hun_two(t_nums **a, t_nums **b, int pos, int tot); 74 | int ra_or_rra(t_nums **a, int tot, int pos); 75 | int ra_or_rra_two(t_nums **a, int tot_minus_pos, int i); 76 | int tot_value(t_nums *a); 77 | int pos_finder(t_nums *a, int pos, int small); 78 | int push_and_i(t_nums **a, t_nums **b); 79 | int push_and_find(t_nums **a, t_nums **b, int small); 80 | int push_b_and_write(t_nums **a, t_nums **b); 81 | int sort_three_sa_and_rra(t_nums **a); 82 | int sort_three_sa_and_ra(t_nums **a); 83 | int sort_three_sa_and_write(t_nums **a); 84 | int sort_three_ra_and_write(t_nums **a); 85 | int sort_three_rra_and_write(t_nums **a); 86 | int sort_three(t_nums **a); 87 | int min_finder(t_nums *a, int min); 88 | int my_insert_sort(t_nums **a, t_nums **b, int i); 89 | int ft_isdigitsss(char c); 90 | void swap_a(t_nums **nums); 91 | void swap_b(t_nums **nums); 92 | void ss(t_nums **a, t_nums **b); 93 | void rotate_a(t_nums **nums); 94 | void rotate_b(t_nums **nums); 95 | void rr(t_nums **a, t_nums **b); 96 | void reverse_rotate_a(t_nums **nums); 97 | void reverse_rotate_b(t_nums **nums); 98 | void rrr(t_nums **a, t_nums **b); 99 | void push_a(t_nums **a, t_nums **b); 100 | void push_b(t_nums **a, t_nums **b); 101 | void print_list(t_nums *nums); 102 | int first_confirmed_ordered(t_nums *nums); 103 | int final_confirmed_ordered(t_nums *nums, t_nums *b); 104 | void apply_command(char *str, t_nums **a, t_nums **b); 105 | int grab_command(t_nums **a, t_nums **b); 106 | #endif 107 | --------------------------------------------------------------------------------