{"id":20442855,"url":"https://github.com/simon-zerisenay/42_push_swap","last_synced_at":"2026-07-16T04:32:23.738Z","repository":{"id":172539527,"uuid":"645879603","full_name":"simon-zerisenay/42_Push_Swap","owner":"simon-zerisenay","description":"Pushswap is a 42 project emphasizing efficient sorting by minimizing operations. Participants use a limited set of commands to manipulate stacks and achieve the desired sorted order, showcasing algorithm design and optimization skills while developing problem-solving abilities.","archived":false,"fork":false,"pushed_at":"2024-01-15T07:10:26.000Z","size":83,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-30T17:40:43.077Z","etag":null,"topics":["42","42pushswap","c","chunking","cprogramming","ecole42","linkedlist","midpoint","pushswap","sorting-algorithms","stacks","struct"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simon-zerisenay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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-05-26T16:50:29.000Z","updated_at":"2025-10-03T22:17:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"82540dda-f390-4c01-97bc-5e9b2decd30c","html_url":"https://github.com/simon-zerisenay/42_Push_Swap","commit_stats":null,"previous_names":["simon-zerisenay/42_push_swap"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/simon-zerisenay/42_Push_Swap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simon-zerisenay%2F42_Push_Swap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simon-zerisenay%2F42_Push_Swap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simon-zerisenay%2F42_Push_Swap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simon-zerisenay%2F42_Push_Swap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simon-zerisenay","download_url":"https://codeload.github.com/simon-zerisenay/42_Push_Swap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simon-zerisenay%2F42_Push_Swap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35531123,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-16T02:00:06.687Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["42","42pushswap","c","chunking","cprogramming","ecole42","linkedlist","midpoint","pushswap","sorting-algorithms","stacks","struct"],"created_at":"2024-11-15T09:43:17.914Z","updated_at":"2026-07-16T04:32:23.717Z","avatar_url":"https://github.com/simon-zerisenay.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\t\n\u003ch1\u003e Push Swap \u003c/h1\u003e\n\n\u003ca href=\"https://github.com/simon-zerisenay/42_push_swap\"\u003e![42 Badge](https://github.com/mcombeau/mcombeau/blob/main/42_badges/push_swapm.png)\u003c/a\u003e\n\n\u003c/div\u003e\n\u003clabel\u003e\n\t\u003ch2\u003e Score \u003c/h2\u003e\t\n\t\u003cimg alt=\"125\" style=\"width: 100px;height: 70px\" src=\"https://github.com/simon-zerisenay/simon-zerisenay/blob/main/125.png\"/\u003e\n\u003c/label\u003e\n\u003ch2\u003eIntroduction \u003c/h2\u003e \n\u003cp align=\"center\"\u003e\n\t\u003cimg alt=\"GitHub code size in bytes\" src=\"https://img.shields.io/github/languages/code-size/simon-zerisenay/42_Push_Swap?color=lightblue\" /\u003e\n\t\u003cimg alt=\"Number of lines of code\" src=\"https://img.shields.io/tokei/lines/github/simon-zerisenay/42_Push_Swap?color=critical\" /\u003e\n\t\u003cimg alt=\"Code language count\" src=\"https://img.shields.io/github/languages/count/simon-zerisenay/42_Push_Swap?color=yellow\" /\u003e\n\t\u003cimg alt=\"GitHub top language\" src=\"https://img.shields.io/github/languages/top/simon-zerisenay/42_Push_Swap?color=blue\" /\u003e\n\t\u003cimg alt=\"GitHub last commit\" src=\"https://img.shields.io/github/last-commit/simon-zerisenay/42_Push_Swap?color=green\" /\u003e \n\u003c/p\u003e\n\nWelcome to the Push Swap project! This project is part of the curriculum at 42 and focuses on sorting algorithms and the manipulation of stack data structures. Push Swap involves creating two programs: one that sorts a stack of integers using a specific set of operations, and another that checks if the given set of instructions properly sorts the stack.\n\n\u003ch2\u003eObjective\u003c/h2\u003e\nThe main objective of the Push Swap project is to develop efficient sorting algorithms that can arrange a stack of integers in ascending order using a limited set of operations. Additionally, you are required to implement a checker program that verifies if a given set of instructions correctly sorts the stack.\n\n\u003ch2\u003eFeatures\u003c/h2\u003e\nSorting Algorithm\nPush Swap allows you to implement different sorting algorithms to arrange the stack of integers. For this project, a custom algorithm is commonly used for optimal performance:\n\nMidpoint Algorithm: This algorithm assigns indexes to the numbers based on their order in the stack. It then calculates the midpoint by adding the indexes and finding the mean. The algorithm repeatedly sends all the numbers with indexes lower than the midpoint to stack B. This process is repeated until only 3 numbers are left on stack A. The 3 remaining numbers are used as a reference to push back from stack B to stack A. The algorithm calculates the cost of each operation and undertakes the cheapest one to minimize the number of moves required.\nBy utilizing this custom algorithm, you can achieve efficient sorting with a reduced number of operations.\n\n\u003ch2\u003eStack Manipulation\u003c/h2\u003e\nThe project requires manipulating two stacks, stack A and stack B, using a set of predefined operations:\n\nsa/sb: Swap the top two elements of stack A/B.\nss: Perform both sa and sb.\npa/pb: Push the top element from stack B/A onto stack A/B.\nra/rb: Rotate the stack A/B by moving the top element to the bottom.\nrr: Perform both ra and rb.\nrra/rrb: Reverse rotate the stack A/B by moving the bottom element to the top.\nrrr: Perform both rra and rrb.\nThese operations allow you to rearrange the elements in the stacks and ultimately sort the integers.\n\n\u003ch2\u003eChecker Program\u003c/h2\u003e\nIn addition to the sorting program, you are required to create a checker program. The checker program takes a list of instructions and verifies if executing those instructions on the stack correctly sorts the integers. It displays \"OK\" if the stack is sorted after executing the instructions and \"KO\" otherwise.\n\n\u003ch2\u003eInstallation and Usage\u003c/h2\u003e\nTo install and run the Push Swap project, follow these steps:\n\nClone the project repository: \n\n\t\t\t\tgit clone https://github.com/your_username/42-push_swap.git\nNavigate to the project directory: \n\t\t\t\t\n\t\t\t\t\t\tcd 42-push_swap\nCompile the project using the provided Makefile: \n\t\t\t\t\t\n\t\t\t\t     \t\t   make\nSort the integers using the push_swap program: \n\n\t\t\t./push_swap \u003cEnter as many numbers as you want but separated by space\u003e\nVerify the sorting using the checker program: \n\t\t\t\n\t\t\t\t\t  ./checker \u003clist_of_integers\u003e\nEnsure that you have the necessary libraries and dependencies installed on your system. The project's repository may provide further instructions on any additional requirements.\n\n\u003ch2\u003eTesting\u003c/h2\u003e\nTo test the Push Swap project and validate its functionality, follow these steps:\n\nGenerate a random set of integers using the provided generate.sh script.\nSort the generated integers using the push_swap program.\nExecute the obtained instructions on the stack using the checker program.\nVerify that the checker program displays \"OK\" if the stack is sorted correctly.\nTest the project with various sets of integers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimon-zerisenay%2F42_push_swap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimon-zerisenay%2F42_push_swap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimon-zerisenay%2F42_push_swap/lists"}