{"id":15893261,"url":"https://github.com/nunofachada/sorttest_py","last_synced_at":"2025-04-02T17:41:20.803Z","repository":{"id":74270399,"uuid":"96129521","full_name":"nunofachada/sorttest_py","owner":"nunofachada","description":"Self-contained Python program for testing sorting algorithms","archived":false,"fork":false,"pushed_at":"2020-11-20T17:55:39.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-08T08:15:21.850Z","etag":null,"topics":["benchmarking","bubble-sort","mergesort","python","python3","quicksort","selection-sort","selectionsort","sorting-algorithms"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/nunofachada.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":"2017-07-03T16:15:11.000Z","updated_at":"2017-07-03T17:12:32.000Z","dependencies_parsed_at":"2023-07-12T04:46:10.379Z","dependency_job_id":null,"html_url":"https://github.com/nunofachada/sorttest_py","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nunofachada%2Fsorttest_py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nunofachada%2Fsorttest_py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nunofachada%2Fsorttest_py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nunofachada%2Fsorttest_py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nunofachada","download_url":"https://codeload.github.com/nunofachada/sorttest_py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246863624,"owners_count":20846288,"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":["benchmarking","bubble-sort","mergesort","python","python3","quicksort","selection-sort","selectionsort","sorting-algorithms"],"created_at":"2024-10-06T08:09:32.552Z","updated_at":"2025-04-02T17:41:20.779Z","avatar_url":"https://github.com/nunofachada.png","language":"Python","readme":"### Self-contained Python program for benchmarking sorting algorithms\n\n#### Usage\n\n```\npython sorttest.py SORTALG NUM SEED [CHECK]\n    SORTALG - Sorting algorithm: bubble, selection, merge, quick\n        NUM - Number of elements to sort\n       SEED - Seed for random number generator\n      CHECK - Check if sorting is correct\n```\n\nFor example, invoking `sorttest` to sort an integer array of 100,000 elements\nusing Bubble sort and a random number generator seed of 99823:\n\n```\n$ python sorttest.py bubble 100000 99823\n```\n\nIf a 4th argument is given, the program checks the correctness of the sorting\nprocedure:\n\n```\n$ python sorttest.py bubble 100000 34545 yes\nSorting Ok!\n```\n\n#### Benchmarking with GNU Time\n\nIn several Linux OSes the [GNU Time] utility must be explicitly installed using\nthe package manager and invoked as `/usr/bin/time`. On OSX it should be\ninstalled using [Homebrew] or similar, and it is invoked as `gtime`.\n\nIt is also possible to use the shell built-in *time* command, which is available\nby default on Linux and OSX. For Windows, [Cygwin] and [MinGW] provide a [Bash]\nshell with this command, but there are [native alternatives].\n\n##### Default output format\n\nThe [PerfAndPubTools] benchmark analysis functions accept the default output\nformat of the [GNU Time] command, as shown in the following example:\n\n```\n$ /usr/bin/time python sorttest.py merge 500000 99823\n3.22user 0.01system 0:03.23elapsed 100%CPU (0avgtext+0avgdata 48672maxresident)k\n0inputs+0outputs (0major+12088minor)pagefaults 0swaps\n```\n\nOf course, the output should be redirected to a file in order to be used by\n[PerfAndPubTools]:\n\n```\n$ /usr/bin/time python sorttest.py quick 1000000 2362 2\u003e time.txt \n```\n\n##### Alternative output formats\n\nThe `-f` option allows to format the output of the [GNU Time] command. For\nexample, the `%e` format specifier shows the elapsed wall clock time used by the\nprocess (in seconds), while the `%M` specifier displays the maximum resident set\nsize of the process during its lifetime, in Kilobytes. These are useful for\ntesting the time and space complexity of each algorithm:\n\n```\n$ /usr/bin/time -f \"%e sec.\\n%M Kb\\n\" python sorttest.py bubble 100000 128\n607.27 sec.\n18408 Kb\n\n$ /usr/bin/time -f \"%e sec.\\n%M Kb\\n\" python sorttest.py selection 100000 128\n331.03 sec.\n18856 Kb\n\n$ /usr/bin/time -f \"%e sec.\\n%M Kb\\n\" python sorttest.py merge 100000 128\n0.58 sec.\n16948 Kb\n\n$ /usr/bin/time -f \"%e sec.\\n%M Kb\\n\" python sorttest.py quick 100000 128\n0.48 sec.\n17504 Kb\n```\n\n#### License\n\n[MIT License](http://opensource.org/licenses/MIT)\n\n[GNU Time]: https://www.gnu.org/software/time/\n[Homebrew]: http://brew.sh/\n[PerfAndPubTools]: https://github.com/fakenmc/perfandpubtools\n[Cygwin]: https://www.cygwin.com/\n[MinGW]: http://www.mingw.org/\n[Bash]: http://tiswww.case.edu/php/chet/bash/bashtop.html\n[tricky]: http://stackoverflow.com/questions/13356628/is-there-a-way-to-redirect-time-output-to-file-in-linux\n[native alternatives]: http://stackoverflow.com/questions/673523/how-to-measure-execution-time-of-command-in-windows-command-line\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnunofachada%2Fsorttest_py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnunofachada%2Fsorttest_py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnunofachada%2Fsorttest_py/lists"}