How grotoo/push_swap works
Push_swap accepts integers as separate arguments or one space-separated argument, rejects invalid or duplicate values, then emits stack-operation instructions to sort stack A. Its main dispatch selects small-input sorters or radix sort after assigning indices; an already sorted input exits without operations. The graph also captures the stack-operation layer and the bundled printf implementation used to print instructions. Several implementation files were not excerpted, so links to their behavior are included only where the README or an excerpt supports them.
Main entry points: main.c Program entry and dispatch · sort_3.c Three-item sort · ft_printf.c Format dispatch · radix.c Radix sort
Components 20
Input and validation
- Program entry and dispatch
srcs/main.c - Argument splitting
srcs/ft_split.c - Input validation
srcs/check.c - Integer conversion
srcs/ft_atoi.c - Stack construction
srcs/add.c - Duplicate detection
srcs/push_swap_utils.c
Sorting strategies
- Sorted check
srcs/is_sorted.c - Rank indexing
srcs/set_index.c - Three-item sort
srcs/sort_3.c - Four-item sort
srcs/sort_4.c - Five-item sort
srcs/sort_5.c - Radix sort
srcs/radix.c
Stack operations
- Swap operations
srcs/swap.c - Push operations
srcs/push.c - Rotate operations
srcs/rotate.c - Reverse rotations
srcs/reverse_rotate.c
Output support
- Format dispatch
libft/ft_printf.c - Format handlers
libft/ft_printf_d.c - Formatter interface
libft/libft.h
Other components
- User
Connections 21
- User → Program entry and dispatch: provides arguments
README.md - Program entry and dispatch → Argument splitting: splits single argument
srcs/main.c - Program entry and dispatch → Input validation: validates tokens
srcs/main.c - Program entry and dispatch → Integer conversion: converts tokens
srcs/main.c - Program entry and dispatch → Stack construction: adds values
srcs/main.c - Program entry and dispatch → Duplicate detection: checks duplicates
srcs/main.c - Program entry and dispatch → Sorted check: checks order
srcs/main.c - Program entry and dispatch → Rank indexing: assigns ranks
srcs/main.c - Program entry and dispatch → Three-item sort: dispatches at three
srcs/main.c - Program entry and dispatch → Four-item sort: dispatches at four
srcs/main.c - Program entry and dispatch → Five-item sort: dispatches at five
srcs/main.c - Program entry and dispatch → Radix sort: dispatches above five
srcs/main.c - Three-item sort → Swap operations: invokes swaps
srcs/sort_3.c - Three-item sort → Rotate operations: invokes rotations
srcs/sort_3.c - Three-item sort → Reverse rotations: invokes reverse rotations
srcs/sort_3.c - Radix sort → Rotate operations: rotates set bits
srcs/radix.c - Radix sort → Push operations: moves bit groups
srcs/radix.c - Swap operations → Format dispatch: prints instruction
srcs/swap.c - Format dispatch → Format handlers: dispatches formats
libft/ft_printf.c - Format dispatch → Formatter interface: uses declarations
libft/ft_printf.c - Format dispatch → User: prints result
README.md