{"id":27112001,"url":"https://github.com/alessandroconti11/sorting_network","last_synced_at":"2025-10-08T06:45:38.067Z","repository":{"id":285936722,"uuid":"951369001","full_name":"AlessandroConti11/Sorting_Network","owner":"AlessandroConti11","description":"In this repository you can find the implementation of some sorting networks.","archived":false,"fork":false,"pushed_at":"2025-07-20T08:03:03.000Z","size":1504,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-25T02:22:04.345Z","etag":null,"topics":["2d-array","2d-odd-even-transposition-sort","3n-sort","3n-sort-of-schnorr-and-shamir","4-way-mergesort","adapted-bitonic-sort","array","bitonic-sort","cpp","ls3-sort","odd-even-merge-sort","odd-even-transposition-sort","openmp","shearsort","sorting","sorting-network"],"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/AlessandroConti11.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2025-03-19T15:12:28.000Z","updated_at":"2025-07-20T08:03:06.000Z","dependencies_parsed_at":"2025-04-03T13:24:10.013Z","dependency_job_id":"ce1aaeb2-65aa-44b6-9def-d94b5a3d6d2e","html_url":"https://github.com/AlessandroConti11/Sorting_Network","commit_stats":null,"previous_names":["alessandroconti11/sorting_network"],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/AlessandroConti11/Sorting_Network","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlessandroConti11%2FSorting_Network","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlessandroConti11%2FSorting_Network/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlessandroConti11%2FSorting_Network/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlessandroConti11%2FSorting_Network/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlessandroConti11","download_url":"https://codeload.github.com/AlessandroConti11/Sorting_Network/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlessandroConti11%2FSorting_Network/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278903011,"owners_count":26065786,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"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":["2d-array","2d-odd-even-transposition-sort","3n-sort","3n-sort-of-schnorr-and-shamir","4-way-mergesort","adapted-bitonic-sort","array","bitonic-sort","cpp","ls3-sort","odd-even-merge-sort","odd-even-transposition-sort","openmp","shearsort","sorting","sorting-network"],"created_at":"2025-04-07T01:42:25.443Z","updated_at":"2025-10-08T06:45:38.052Z","avatar_url":"https://github.com/AlessandroConti11.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sorting_Network\n\n\nAuthor: Alessandro Conti - [AlessandroConti11](https://github.com/AlessandroConti11)\n\nLicense: [MIT license](LICENSE).\n\n\nTags: `#2D-array`, `#2D_odd-even_transposition_sort`, `#3n_sort`, `#3n_sort_of_Schnorr_and_Shamir`, `#4-way_mergesort`, `#adapted_bitonic_sort`, `#array`, `#bitonic_sort`, `#c++`, `#cpp`, `#LS3_sort`, `#odd-even_mergesort`, `#odd-even_transposition_sort`, `#OpenMP`, `#rotatesort`, `#shearsort`, `#sorting`, `#sorting_network`.\n\n\n## Specification\n\nIn this repository you can find the implementation of some sorting networks. \n\nA **Sorting Network** is a comparator network that sorts all input sequences. \nSorting networks are special cases of general sorting algorithms, since all comparisons are data-independent. \nThis makes sorting network suitable for the implementation in hardware or in parallel processor arrays, sorting on two-dimensional processor arrays. \n\nThe implemented sorting networks are:\n- [odd-even transposition sort](odd-even_transposition_sort/README.md)\n- [odd-even mergesort](odd-even_mergesort/README.md)\n- [bitonic sort](bitonic_sort/README.md)\n- [adapted bitonic sort](adapted_bitonic_sort/README.md)\n- [LS3 sort](LS3_sort/README.md)\n- [4-way mergesort](4-way_mergesort/README.md)\n- [rotatesort](rotatesort/README.md)\n- [3n sort of Schnorr and Shamir](3n_sort_Schnorr_and_Shamir/README.md)\n- [2D odd-even transposition sort](2D_odd-even_transposition_sort/README.md)\n- [shearsort](shearsort/README.md).\n\nIn this repository, in addition to the implementation of sorting networks, there is also a python script that compares the various complexities of the implemented algorithms.\n\nFor more details, you can read the [slides](bidimensional_sorting_v4.pdf) explaining the various sorting networks in detail.\n\n\n## How to run\n\nThe steps below refer to a Unix environment, for other environments the commands may change.\n\n### The implementation of sorting networks\n\n0. install gcc\n    ```bash\n    sudo apt-get install gcc \n    ```\n1. compile each source file into an object file\n    ```bash\n    g++ -std=c++20 -Wall -Werror -Wextra -O2 -fopenmp -c FILE.cpp -o FILE.o\n    ```\n2. link all object files into an executable\n    ```bash\n    g++ -std=c++20 -Wall -Werror -Wextra -O2 -fopenmp\\\n    main.o \\\n    odd-even_transposition_sort/odd-even_transposition_sort.o \\\n    odd-even_mergesort/odd-even_mergesort.o \\\n    bitonic_sort/bitonic_sort.o \\\n    adapted_bitonic_sort/adapted_bitonic_sort.o \\\n    LS3_sort/LS3_sort.o \\\n    4-way_mergesort/4-way_mergesort.o \\\n    rotatesort/rotatesort.o \\\n    3n_sort_Schnorr_and_Shamir/3n_sort_Schnorr_and_Shamir.o \\\n    2D_odd-even_transposition_sort/2D_odd-even_transposition_sort.o \\\n    shearsort/shearsort.o \\\n    -o EXECUTABLE\n    ```\n3. run the executable\n    ```bash\n    ./EXECUTABLE\n    ```\n\n\u003cbr\u003e\n\nThe Makefile in the repository can also be used to compile the code.\n- this option allows you to compile with the following tags: *-std=c++20 -Wall -Werror -Wextra -O2 -fopenmp*\n    ```bash\n    make\n    ```\n- if you want to specify different tags, you can set them\n   ```bash\n   make compile CXXFLAGS=YOUR_FLAGS\n   ```\n- if you want to remove all .o files and the final executable\n    ```bash\n    make clean\n    ```\n\n\u003cbr\u003e\n\nThe CMakeLists.txt in the repository can also be used to compile the code.\n\n0. install cmake\n    ```bash\n    sudo apt-get install cmake\n    ```\n1. create the build folder\n    ```bash\n    mkdir build \u0026\u0026 cd build\n    ```\n2. generate compilation files\n    ```bash\n    cmake ..\n    ```\n3. build the project\n    ```bash\n    cmake --build .\n    ```\n4. run the executable\n    ```bash\n    ./sorting_network\n    ```\n\n### The comparison of algorithm complexities\n\n0. install python and pip\n   ```bash\n   sudo apt-get install python3 \u0026\u0026 \\\n   sudo apt-get install python3-pip\n   ```\n1. install the requirements\n   ```bash\n   pip install -r requirements.txt\n   ```\n2. run the script\n   ```bash\n   python3 sorting_network_complexity.py\n   ```\n\n\n## Contribute\n\n- If you find a security vulnerability, do NOT open an issue. Email [Alessandro Conti](mailto:ale.conti.1101@gmail.com) instead.\n- If you find a bug or error or want to add some other function that is not implemented yet\n    1. **FORK** the repo\n    2. **CLONE** the project to your own machine\n    3. **COMMIT** to your own branch\n    4. **PUSH** your work back up to your fork\n    5. submit a **PULL REQUEST** so that I can review your changes\n  \u003e NOTE: Be sure to merge the latest from \"upstream\" before making a pull request!\n\n\n### Code Style\n\nEach new function must be documented using the following style:\n- *Short function description*: A brief description explaining what the function does.\n- *@warning*: A section listing all the assumptions made by the function, such as the preconditions that the parameters must fulfil.\n- *Blank line*: Add a blank line to separate the documentation sections.\n- *@details*: A detailed section describing how the function works, explaining the algorithms and logic used.\n- *Blank line*: Add a blank line to separate the documentation sections.\n- *@param*: A list of the parameters required by the function, each accompanied by a brief description of its role and type.\n- *@return*: A description of what the function returns, including the data type.\n\nIn general, any additional comments that might improve understanding of the code are welcome. 😃\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falessandroconti11%2Fsorting_network","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falessandroconti11%2Fsorting_network","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falessandroconti11%2Fsorting_network/lists"}