Remarks - pin3dev/42_Push_Swap GitHub Wiki

Stack Filling Order

🚨 Note that the head of the first linked list (stack A), i.e. its top, is configured to point to the first value passed through the input.
It's a strange approach, but one requested by the subject.

Input example:

$~ ./push_swap 1 3 6 0

Linked list order:

➡️ 1 3 6 0 ...

🚨 Also, when moving nodes from the first list (stack A) to the second list (stack B),
the linked lists should be considered as stacks, only removing and adding from the top (head).

Stack display:

top 1
base 0

Moviments and Stacks

🚨 Only two stacks are allowed to use, the original stack A and stack supporting sort B.
🚨 Only internal rotational movements in the stacks and the transfer of nodes from the top between the stacks are permitted.

STACK swap↕️ reverse-rotate↗️ rotate↘️ push➡️
A sa rra ra pa
B sb rrb rb pb
A&B ss rrr rr none

⏮️ Previous
Next ⏭️