{"id":19878854,"url":"https://github.com/jakubkorytko/sort-analysis","last_synced_at":"2026-06-06T13:31:46.196Z","repository":{"id":206489859,"uuid":"661716280","full_name":"JakubKorytko/sort-analysis","owner":"JakubKorytko","description":"Project analyzing the performance of sorting algorithms, with implementations, efficiency analysis, and a comprehensive report","archived":false,"fork":false,"pushed_at":"2023-11-24T17:01:56.000Z","size":4766,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-11T17:49:14.671Z","etag":null,"topics":["algorithms-analysis","mit-license","open-source","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JakubKorytko.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":"2023-07-03T13:39:03.000Z","updated_at":"2023-11-24T17:09:14.000Z","dependencies_parsed_at":"2023-11-23T13:46:00.859Z","dependency_job_id":"cb0d4ad2-70d0-4b73-976b-e6b66913dc10","html_url":"https://github.com/JakubKorytko/sort-analysis","commit_stats":null,"previous_names":["jakubkorytko/sort-analysis"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JakubKorytko%2Fsort-analysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JakubKorytko%2Fsort-analysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JakubKorytko%2Fsort-analysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JakubKorytko%2Fsort-analysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JakubKorytko","download_url":"https://codeload.github.com/JakubKorytko/sort-analysis/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241309093,"owners_count":19941722,"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":["algorithms-analysis","mit-license","open-source","sorting-algorithms"],"created_at":"2024-11-12T17:06:53.061Z","updated_at":"2026-06-06T13:31:46.185Z","avatar_url":"https://github.com/JakubKorytko.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sort Analysis\n\n[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge)](LICENSE)\n![C](https://img.shields.io/badge/c-%2300599C.svg?style=for-the-badge\u0026logo=c\u0026logoColor=white)\n\n[![Open Source Love svg1](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/ellerbrock/open-source-badges/)\n[![Run Super-Linter](https://github.com/JakubKorytko/sort-analysis/actions/workflows/super-linter.yml/badge.svg)](https://github.com/JakubKorytko/sort-analysis/actions/workflows/super-linter.yml)\n[![Run make targets to check for errors](https://github.com/JakubKorytko/sort-analysis/actions/workflows/make.yml/badge.svg)](https://github.com/JakubKorytko/sort-analysis/actions/workflows/make.yml)\n\n## Table of Contents\n\n- [Sort Analysis](#sort-analysis)\n  - [Table of Contents](#table-of-contents)\n  - [Introduction](#introduction)\n  - [Prerequisites](#prerequisites)\n  - [Installation](#installation)\n  - [Data file](#data-file)\n  - [Text coloring](#text-coloring)\n  - [Usage](#usage)\n    - [Menu](#menu)\n    - [Available algorithms](#available-algorithms)\n      - [Group 1](#group-1)\n      - [Group 2](#group-2)\n  - [Tools](#tools)\n    - [Generate](#generate)\n    - [Results](#results)\n  - [Contributing](#contributing)\n  - [Contact](#contact)\n  - [License](#license)\n\n## Introduction\n\nSort Analysis is a C-based project that analyzes the performance of various sorting algorithms.\nThis repository contains implementations of classic sorting algorithms\nand tools to generate data and analyze their efficiency.\nThe project focuses on providing insights into the runtime behavior of sorting algorithms\nfor different input sizes.\n\nThe whole project was done according to the [instructions](docs/Instructions.pdf).\n\nIn addition, a [report](docs/Report.pdf) consisting of sorting time comparisons,\na summary with pros and cons, block diagrams, etc. was created.\n\nYou can find both the report and the instructions in the [docs](./docs/) folder of the repository.\n\n**Note:** If you want to edit the project files, make sure to set the include paths in your IDE to the [headers](./headers/) directory or change the `#include` directives in the source files accordingly. The project will compile without them, but the IDE will show include errors.\n\nThe headers directory structure mirrors the source directory structure.\n\n## Prerequisites\n\nBefore you begin, make sure you have the following prerequisites installed on your system:\n\n- [GNU Make 4.4.1 or later](https://www.gnu.org/software/make/)\n- [GNU GCC 11.4 or later](https://gcc.gnu.org)\n\n## Installation\n\n1. Clone this repository to your local machine using Git,\nor download the ZIP file and extract it to a directory of your choice:\n\n    ```bash\n    git clone https://github.com/JakubKorytko/sort-analysis.git\n    ```\n\n1. Change to the project directory:\n\n    ```bash\n    cd sort-analysis\n    ```\n\n1. Compile the program and generate or provide the [data file](#data-file):\n\n    - If you want to generate [data file](#data-file) using the program:\n\n        - Compile the program \u0026 [the tools](#tools) with:\n\n            ```bash\n            make\n            ```\n\n        - Generate the data file (to check what parameters you can pass, see the [section below](#generate)):\n\n            ```bash\n            tools/out/generate\n            ```\n\n            You may need to enclose the command in quotes:\n\n            ```bash\n            \"tools/out/generate\"\n            ```\n\n    - If you want to provide your own [data file](#data-file):\n\n        - Compile only the program (you won't be able to use [the tools](#tools)):\n\n            ```bash\n            make sort\n            ```\n\n        - Remember to provide the data file. See the [section below](#data-file) for details on what it should contain,.\n\n    The compiled executable named `sort`\n    will be placed in the root directory of the project.\n\n## Data file\n\nThe application expects a data file named `data` (without extension) in the root directory of the project. The results tool doesn't require a data file to have a specific name, but you must provide it as a command-line argument (see the [section below](#results)).\n\nThe file should contain a list of integers separated by a single space or a newline character.\nFor example:\n\n```text\n-11 23 3 0 -45 6 9 10 234 9\n```\n\nYou can generate a data file using the [generate tool](#generate) or provide your own.\n\n## Text coloring\n\nThe program uses ANSI escape codes to color the output text. If your terminal doesn't support them, you can disable the coloring by setting the `ENABLE_COLORING` environment variable to `false` before running the program:\n\nUnix-like systems:\n\n```bash\nexport ENABLE_COLORING=false\n```\n\nWindows:\n\n```bash\nset ENABLE_COLORING=false\n```\n\nIf you want this setting to be permanent, add the environment variable to your shell's configuration file or change the `ENABLE_COLORING` variable in the [Makefile](Makefile).\n\nYou can also change the `is_coloring_enabled` function in the [print.c](src/utils/print.c) file to always return `false`.\n\n## Usage\n\nAfter running the program, you will be asked to enter the number of elements to sort.\nIf the data file has been provided, the program will read the data from it.\nOtherwise, it will throw an error and exit.\nIf you specify a number that is greater than the number of elements in the data file,\nunexpected behavior may occur.\nMost likely, the array will be filled with zeros,\nbut this is not guaranteed. Avoid doing this.\n\nThe array will be displayed for you to check if the data has been read correctly. After pressing `ENTER`, the menu will be displayed.\n\n### Menu\n\nThe application has a interactive menu, that takes input (number) from the user and performs the action associated with the number. The menu has the following options:\n\n- 3 options (1-3) to sort the array using the algorithms of the [first group](#group-1)\n- 3 options (4-6) to sort the array using the algorithms of the [second group](#group-2)\n- Option 7 to display the array\n- Option 8 to execute all algorithms one by one\n- Option 9 to restart the program and specify a new number of elements to sort\n- Option 0 to exit the program\n\nOptions 1-6 and 8 will always sort the array, display the sorted array and the time it took to sort it in milliseconds.\n\n### Available algorithms\n\n#### Group 1\n\n- [Insertion sort](./src/algorithms/insertion_sort.c)\n- [Selection sort](./src/algorithms/selection_sort.c)\n- [Bubble sort](./src/algorithms/bubble_sort.c)\n\n#### Group 2\n\n- [Quicksort](./src/algorithms/quick_sort.c)\n- [Shellsort](./src/algorithms/shell_sort.c)\n- [Heapsort](./src/algorithms/heap_sort.c)\n\n## Tools\n\n### Generate\n\nTo generate a [data file](#data-file) you can use the `generate` tool. It is a standalone program that doesn't require compiling the main program. To use it, follow these steps (you should be in the root directory of the project for each step):\n\n1. Run the following command (if you have run `make` before, you can skip this step):\n\n    ```bash\n    make generate\n    ```\n\n    This will compile the `generate` tool and place the executable in the `tools/out` directory.\n\n1. The syntax of the command is:\n\n    ```bash\n    tools/out/generate \u003cnumber_of_elements\u003e \u003cfilename\u003e\n    ```\n\n    where:\n\n    - `\u003cnumber_of_elements\u003e` - specifies how many numbers do you want to generate, *(default: 100000)*\n    - `\u003cfilename\u003e` - [data file](#data-file) name, *(default: data)*\n\n    You can also run the tool without any arguments. In this case, the default values will be used. The `\u003c` and `\u003e` characters are not part of the command and are used as placeholders. You should replace them with the actual values. Remember to use the default filename if you want to use the [data file](#data-file) with the main program (leave it empty or use `data`).\n\n### Results\n\nTo save the results of the running time of the algorithms in `.txt` files, you can use the `results` tool. It is a standalone program that doesn't require the main program to be compiled. To use it, follow these steps (you should be in the root directory of the project for each step):\n\n1. Run the following command (if you have run `make` before, you can skip this step):\n\n    ```bash\n    make results\n    ```\n\n    This will compile the `results` tool and place the executable in the `tools/out` directory.\n\n1. The syntax of the command is:\n\n    ```bash\n    tools/out/results \u003cnumber_of_calls\u003e \u003cdata_filename\u003e \u003calgorithms_indices_from_the_array\u003e\n    ```\n\n    where:\n\n    - `\u003cnumber_of_calls\u003e` - specifies the number of calls to the sorting algorithms, where each subsequent call performs a sort on the number of elements specified by the sequence:\n        `1000, 2000, 5000, 10000, 20000, 50000, 100000, 200000, 500000, 1000000...`, *(default: 5)*\n\n        For example:\n\n        `tools/out/results 1 \u003c...\u003e` - sorts 1000 numbers  \n        `tools/out/results 2 \u003c...\u003e` - sorts 1000 numbers and 2000 numbers\n\n        When using the command for **N** calls, the time of each algorithm call will be saved to the result files, separately for each of the 3 tests.\n\n    - `\u003cdata_filename\u003e` - generated (or provided) [data file](#data-file) name, *(default: data)*\n    - `\u003calgorithms_indices_from_the_array\u003e` (separated by whitespace, between 0 and 5):\n        - `0` – Insertion sort\n        - `1` – Selection sort\n        - `2` – Bubble sort\n        - `3` - Quicksort\n        - `4` - Shellsort\n        - `5` - Heapsort  \n        *(default: 0 1 2 3 4 5)*\n\n        For example:\n\n        `tools/out/results \u003c...\u003e 1 2` - runs Selection sort \u0026 Bubble sort\n\n    After running the command from the project root directory, the results should appear in the `results/` subdirectory.\n\n## Contributing\n\nIf you find issues or have suggestions for improvements,\nfeel free to open an issue or submit a pull request.\nContributions are welcome!\n\n## Contact\n\nIf you have any questions, feel free to contact me at \u003cjakub@korytko.me\u003e.\n\n## License\n\nThis project is released under the MIT License.\nSee the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakubkorytko%2Fsort-analysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjakubkorytko%2Fsort-analysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakubkorytko%2Fsort-analysis/lists"}