{"id":18429688,"url":"https://github.com/jonperk318/sorting-algorithms","last_synced_at":"2026-05-08T05:37:30.389Z","repository":{"id":247289725,"uuid":"825172235","full_name":"jonperk318/sorting-algorithms","owner":"jonperk318","description":"Comparing the efficiencies of sorting algorithms in Python, Java, C++, and JavaScript","archived":false,"fork":false,"pushed_at":"2024-08-25T04:52:38.000Z","size":19770,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-16T08:43:35.077Z","etag":null,"topics":["bubble-sort","counting-sort","cpp","heapsort","insertion-sort","java","javascript","matplotlib","merge-sort","mergesort","python3","quick-sort","quicksort","radix-sort","selection-sort","sorting-algorithm","sorting-algorithm-visualizations","sorting-algorithms","sorting-algorithms-implemented"],"latest_commit_sha":null,"homepage":"https://jonperk318.github.io/sorting-algorithms/","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/jonperk318.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}},"created_at":"2024-07-07T02:23:31.000Z","updated_at":"2024-08-25T04:52:41.000Z","dependencies_parsed_at":"2024-08-25T05:47:25.031Z","dependency_job_id":null,"html_url":"https://github.com/jonperk318/sorting-algorithms","commit_stats":null,"previous_names":["jonperk318/sorting-algorithms"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonperk318%2Fsorting-algorithms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonperk318%2Fsorting-algorithms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonperk318%2Fsorting-algorithms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonperk318%2Fsorting-algorithms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonperk318","download_url":"https://codeload.github.com/jonperk318/sorting-algorithms/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248788868,"owners_count":21161726,"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":["bubble-sort","counting-sort","cpp","heapsort","insertion-sort","java","javascript","matplotlib","merge-sort","mergesort","python3","quick-sort","quicksort","radix-sort","selection-sort","sorting-algorithm","sorting-algorithm-visualizations","sorting-algorithms","sorting-algorithms-implemented"],"created_at":"2024-11-06T05:18:22.137Z","updated_at":"2026-05-08T05:37:30.339Z","avatar_url":"https://github.com/jonperk318.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sorting Algorithms in Four Languages\nComparing the efficiencies of sorting algorithms implemented \nin four programming languages: Python, Java, C++, and JavaScript.\n\nResults: https://jonperk318.github.io/sorting-algorithms/\n\n## How to Use\nLanguages and packages used:\n* Python 3.12.2\n* Java 21.0.1\n* C++ Apple Clang 15.0.0 (clang-1500.3.9.4)\n* JavaScript Node 20.15.0\n* webpack-cli 5.1.4\n\nFirst, run `./samples/sample_generator.py` to generate 50 sample arrays of logarithmically-spaced sizes from\n10 to 10,000, each containing randomly-generated integers ranging from 1 to 1,000. These arrays are outputted into text \nfiles along with `./samples/sample-sizes.txt`, which contains the array sizes.\n\nSecond, run the following four main functions each utilizing eight sorting algorithms implemented in their respective \nlanguages:\n* `./python-algorithms/main.py`\n* `./java-algorithms/src/Main.java`\n* `./cpp-algorithms/main.cpp`\n* `./javascript-algorithms/main.js`\n\nThese each generate text files containing the sorting times for each algorithm.\n\nThird, run `./src/result-loader.js` to convert these results into `./dist/results.js`, using a format readable by \n`./dist/main.js`. To generate this file, run `npx webpack` in the root directory.\n\n## Results\n\nThe first four sections show all sorting algorithms in one of four languages. The y-axis \nof each graph is scaled logarithmically.\n\nIn all four languages, for the largest arrays, bubble sort was the slowest and counting sort was the fastest. \nFor the smallest arrays, insertion sort was the fastest and either merge sort or counting sort were the slowest.\n\n![demo-1.gif](src/demo-1.gif)\n\nPython was often the slowest language on average for all except counting sort and radix sort, which on average \nhad slower times in Java.\n\nJavaScript had the fastest times for larger arrays on all algorithms except for merge sort, \nand Java came in second on several others.\n\n![demo-2.gif](src/demo-2.gif)\n\n## Sources\n\nThis project was inspired by:\n* The sorting algorithms demonstrated in multiple languages on GeeksforGeeks:\n  https://www.geeksforgeeks.org/sorting-algorithms/\n* A sorting benchmark project by Ilya Frolov:\n  https://github.com/frolovilya/sorting-benchmark/","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonperk318%2Fsorting-algorithms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonperk318%2Fsorting-algorithms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonperk318%2Fsorting-algorithms/lists"}