{"id":20604952,"url":"https://github.com/shuygena/push_swap","last_synced_at":"2026-04-22T07:33:10.546Z","repository":{"id":170876070,"uuid":"491977907","full_name":"shuygena/push_swap","owner":"shuygena","description":":signal_strength: Push-swap 2 stacks sorting ","archived":false,"fork":false,"pushed_at":"2022-06-16T20:40:08.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-17T02:22:44.941Z","etag":null,"topics":["42","42projects","radix-sort","sorting-algorithms","stack-sorting"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shuygena.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-13T17:01:53.000Z","updated_at":"2022-09-17T19:41:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"a2e3d4fc-d6d7-493b-b0aa-699fecfcb369","html_url":"https://github.com/shuygena/push_swap","commit_stats":null,"previous_names":["shuygena/push_swap"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shuygena%2Fpush_swap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shuygena%2Fpush_swap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shuygena%2Fpush_swap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shuygena%2Fpush_swap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shuygena","download_url":"https://codeload.github.com/shuygena/push_swap/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242250928,"owners_count":20096895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["42","42projects","radix-sort","sorting-algorithms","stack-sorting"],"created_at":"2024-11-16T09:25:52.934Z","updated_at":"2026-04-22T07:33:10.509Z","avatar_url":"https://github.com/shuygena.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## :toolbox: Requirements:  \nGCC compiler  \nGNU Make\n\n## :link: Download \u0026 Compile\nClone repository:\n```\ngit clone https://github.com/shuygena/push_swap push_swap\n```\nGo to directory:\n```\ncd push_swap\n```\nFor compile program run:   \n```make``` (push_swap) or ```make bonus``` (checker)  \n\n## :clipboard: Task  \n### The rules  \n• You have 2 stacks named a and b  \n• At the beginning:   \n◦ The stack a contains a random amount of negative and/or positive numbers  \nwhich cannot be duplicated  \n◦ The stack b is empty  \n• The goal is to sort in ascending order numbers into stack a. To do so you have the  \nfollowing operations at your disposal:   \n**sa** (swap a): Swap the first 2 elements at the top of stack a  \nDo nothing if there is only one or no elements  \n**sb** (swap b): Swap the first 2 elements at the top of stack b  \nDo nothing if there is only one or no elements  \n**ss** : sa and sb at the same time  \n**pa** (push a): Take the first element at the top of b and put it at the top of a  \nDo nothing if b is empty  \n**pb** (push b): Take the first element at the top of a and put it at the top of b  \nDo nothing if a is empty  \n**ra** (rotate a): Shift up all elements of stack a by 1  \nThe first element becomes the last one  \n**rb** (rotate b): Shift up all elements of stack b by 1  \nThe first element becomes the last one  \n**rr** : ra and rb at the same time  \n**rra** (reverse rotate a): Shift down all elements of stack a by 1  \nThe last element becomes the first one  \n**rrb** (reverse rotate b): Shift down all elements of stack b by 1  \nThe last element becomes the first one  \n**rrr** : rra and rrb at the same time.  \n### The \"push_swap\" program  \n• You have to write a program named push_swap that takes as an argument the stack\na formatted as a list of integers. The first argument should be at the top of the\nstack (be careful about the order)  \n• The program must display the smallest list of instructions possible to sort the stack\na, the smallest number being at the top  \n• Instructions must be separated by a ’\\n’ and nothing else  \n• The goal is to sort the stack with the lowest possible number of operations. During\nthe evaluation process, the number of instructions found by your program will be\ncompared against a limit: the maximum number of operations tolerated. If your\nprogram either displays a longer list or if the numbers aren’t sorted properly, your\ngrade will be 0.  \n• If no parameters are specified, the program must not display anything and give the\nprompt back  \n• In case of error, it must display \"Error\" followed by a ’\\n’ on the standard error\nErrors include for example: some arguments aren’t integers, some arguments are\nbigger than an integer and/or there are duplicates  \n### The \"checker\" program\n• Write a program named checker that takes as an argument the stack a formatted\nas a list of integers. The first argument should be at the top of the stack (be careful\nabout the order). If no argument is given, it stops and displays nothing  \n• It will then wait and read instructions on the standard input, each instruction will\nbe followed by ’\\n’. Once all the instructions have been read, the program has to\nexecute them on the stack received as an argument  \n• If after executing those instructions, the stack a is actually sorted and the stack b\nis empty, then the program must display \"OK\" followed by a ’\\n’ on the standard\noutput  \n• In every other case, it must display \"KO\" followed by a ’\\n’ on the standard output.  \n• In case of error, you must display \"Error\" followed by a ’\\n’ on the standard error. Errors include for example: some arguments are not integers, some arguments  \nare bigger than an integer, there are duplicates, an instruction doesn’t exist and/or\nis incorrectly formatted  \n\n## :mortar_board: Tutorial\nUsefull information about radix sorting: https://medium.com/nerd-for-tech/push-swap-tutorial-fa746e6aba1e\n \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshuygena%2Fpush_swap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshuygena%2Fpush_swap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshuygena%2Fpush_swap/lists"}