{"id":20775126,"url":"https://github.com/deruina/push_swap","last_synced_at":"2026-04-21T11:40:14.975Z","repository":{"id":122044044,"uuid":"596926870","full_name":"DeRuina/push_swap","owner":"DeRuina","description":"Push_Swap is a highly efficient C program designed to sort data on two stacks using a specific set of operations. This project is part of the 42 school curriculum, aiming to demonstrate the implementation of complex algorithms and data structures.","archived":false,"fork":false,"pushed_at":"2023-06-15T11:27:11.000Z","size":34708,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-26T22:45:49.497Z","etag":null,"topics":["pushswap","radixsort","sorting-algorithms"],"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/DeRuina.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":"2023-02-03T08:32:09.000Z","updated_at":"2023-12-13T14:14:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"d849c105-c7e1-4bdb-b8dd-57fc55c3dd98","html_url":"https://github.com/DeRuina/push_swap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DeRuina/push_swap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeRuina%2Fpush_swap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeRuina%2Fpush_swap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeRuina%2Fpush_swap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeRuina%2Fpush_swap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DeRuina","download_url":"https://codeload.github.com/DeRuina/push_swap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeRuina%2Fpush_swap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32090896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T11:25:29.218Z","status":"ssl_error","status_checked_at":"2026-04-21T11:25:28.499Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["pushswap","radixsort","sorting-algorithms"],"created_at":"2024-11-17T12:34:35.668Z","updated_at":"2026-04-21T11:40:14.930Z","avatar_url":"https://github.com/DeRuina.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](img/push_swap.png)\n\n# Push_swap\n\n\n#### Because Swap_push isn’t as natural\n\n\n\n## About ##\n\n- Push_swap is a sorting algorithm project at school 42.\n- We start with two stacks called A and B.\n- A is filled with some random integers (without duplicates) and B is empty.\n- We can perform a limited set of instructions on these stacks and the goal is to sort all these integers using the lowest possible number of actions.\n- The limited set of instructions are:\n\n| Operation | Description |\n| ------------ | ------------ |\n| `sa` | swap A - swap the first 2 elements at the top of stack A |\n| `sb` | swap B - swap the first 2 elements at the top of stack B |\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 |\n| `pb` | push B - take the first element at the top of a and put it at the top of B |\n| `ra` | rotate A - shift up all elements of stack A by 1. The first element becomes the last one |\n| `rb` | rotate B - shift up all elements of stack B by 1. The 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. The last element becomes the first one |\n| `rrb` | reverse rotate B - shift down all elements of stack B by 1. The last element becomes the first one |\n| `rrr` | `rra` and `rrb` at the same time |\n\n\n## Links ##\n\n- [LeoFu9487 Tester](https://github.com/LeoFu9487/push_swap_tester.git) (thank you for this awesome tester!)\n\n- [Push_swap Visualizer](https://github.com/o-reo/push_swap_visualizer) (you will need python3 + rust)\n\n- [Radix Sort](https://www.youtube.com/watch?v=nu4gDuFabIM) (I used this algorithm in my project)\n\n## Functions ##\nOnly the following functions are allowed to be used in this project:\n- write\n- read\n- malloc\n- free\n- exit\n- [My own Libft library](https://github.com/DeRuina/Libft.git)\n\n## Usage ##\n\n```bash\n# Clone this project\n$ git clone https://github.com/DeRuina/push_swap.git\n\n# Access\n$ cd push_swap\n\n# Compile the program\n$ make\n\n# Run the project\n$ ./push_swap 5 8 7 2\n\n```\n\n## Testing ##\n\n\nLeoFu9487 tester:\nTo see if you pass the parsing test (ERROR_TEST), identity test, and small stack test (size 3 and 5), run\n```bash\nbash basic_test.sh\n```\nIf you want to see the test cases, check trace_basic\n\nAfter that, you can do medium and big stack test with this command\n```bash\nbash loop.sh \u003cstack size\u003e \u003cloop times\u003e\n```\nFor example, this is the result of the following command\n```bash\nbash loop.sh 100 10\n```\n\n![Visualizer](img/push_swap.gif)\n\n## Author\n\n- [@DeRuina](https://github.com/DeRuina)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderuina%2Fpush_swap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fderuina%2Fpush_swap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderuina%2Fpush_swap/lists"}