How rgrmra/push_swap works
This repository implements push_swap: it reads integer arguments, represents them in two linked-list stacks, emits limited stack operations to sort them, and provides a bonus checker that applies supplied operations and reports whether the result is sorted. The README describes a recursive pivot-based strategy, while the sampled handler shows partitioning and recursive small-range handling. The bonus entry point and operation dispatch are visible in excerpts; several mandatory setup and utility implementations are only indexed, so their internal call relationships are omitted or rely on README-level workflow evidence.
Main entry points: handler.c Recursive handlers · handler_three_a.c Three-item A · handler_three_b.c Three-item B · push_swap_bonus.c Checker entry
Components 19
Input and state
- Sorter entry
srcs/push_swap.c - Input utilities
srcs/push_swap_utils.c - Error handling
srcs/error.c - Stack state
srcs/nodes.c
Sorting strategy
- Pivot partitioning
srcs/stack_a.c - Recursive handlers
srcs/handler.c - Three-item A
srcs/handler_three_a.c - Three-item B
srcs/handler_three_b.c - Small-stack sorts
srcs/sorting.c
Stack operations
- Swap operations
srcs/swap.c - Push operations
srcs/push.c - Rotate operations
srcs/rotate.c - Reverse rotations
srcs/reverse.c
Bonus checker
- Checker entry
srcs/bonus/push_swap_bonus.c - Move dispatcher
srcs/bonus/sorting_bonus.c - Checker operations
srcs/bonus - Checker errors
srcs/bonus/error_bonus.c - Checker utilities
srcs/bonus/push_swap_utils_bonus.c
Other components
- CLI user
Connections 24
- CLI user → Sorter entry: provides numbers
README.md - Sorter entry → Pivot partitioning: sorts stacks
- Sorter entry → Input utilities: uses setup
- Pivot partitioning → Recursive handlers: handles small ranges
srcs/stack_a.c - Recursive handlers → Three-item A: handles A triples
srcs/handler.c - Recursive handlers → Three-item B: handles B triples
srcs/handler.c - Recursive handlers → Swap operations: swaps
srcs/handler.c - Recursive handlers → Push operations: pushes
srcs/handler.c - Recursive handlers → Rotate operations: rotates
srcs/handler.c - Recursive handlers → Reverse rotations: reverses
srcs/handler.c - Three-item A → Small-stack sorts: sorts triples
srcs/handler_three_a.c - Three-item A → Swap operations: swaps
srcs/handler_three_a.c - Three-item A → Rotate operations: rotates
srcs/handler_three_a.c - Three-item A → Reverse rotations: reverses
srcs/handler_three_a.c - Three-item B → Push operations: pushes to A
srcs/handler_three_b.c - Three-item B → Swap operations: swaps
srcs/handler_three_b.c - Three-item B → Rotate operations: rotates
srcs/handler_three_b.c - Three-item B → Reverse rotations: reverses
srcs/handler_three_b.c - CLI user → Checker entry: provides numbers and moves
README.md - Checker entry → Move dispatcher: dispatches moves
srcs/bonus/push_swap_bonus.c - Move dispatcher → Checker operations: applies operations
srcs/bonus/sorting_bonus.c - Checker entry → Checker errors: rejects invalid input
srcs/bonus/push_swap_bonus.c - Checker entry → Checker utilities: reads moves
srcs/bonus/push_swap_bonus.c - Move dispatcher → CLI user: reports sorted status
srcs/bonus/sorting_bonus.c