{"id":18850049,"url":"https://github.com/kaoutherbo/sorting_algorithms","last_synced_at":"2026-02-03T06:30:18.171Z","repository":{"id":223522647,"uuid":"760628563","full_name":"Kaoutherbo/sorting_algorithms","owner":"Kaoutherbo","description":"An ALX project written in C language for Sorting_Algorithms also bits on the Big O notation ","archived":false,"fork":false,"pushed_at":"2024-02-20T17:55:53.000Z","size":62,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-30T15:37:36.207Z","etag":null,"topics":["big-o","bitonic-sort","bubble-sort","complexity","heap-sort","insertion-sort","merge-sort","quick-sort","radix-sort","selection-sort","shell-sort"],"latest_commit_sha":null,"homepage":"","language":"C","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/Kaoutherbo.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":"2024-02-20T16:38:07.000Z","updated_at":"2024-02-21T08:03:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"9d176bdc-4e51-4d53-bd02-de939f248c65","html_url":"https://github.com/Kaoutherbo/sorting_algorithms","commit_stats":null,"previous_names":["kaoutherbo/sorting_algorithms"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaoutherbo%2Fsorting_algorithms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaoutherbo%2Fsorting_algorithms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaoutherbo%2Fsorting_algorithms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaoutherbo%2Fsorting_algorithms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kaoutherbo","download_url":"https://codeload.github.com/Kaoutherbo/sorting_algorithms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239786251,"owners_count":19696772,"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":["big-o","bitonic-sort","bubble-sort","complexity","heap-sort","insertion-sort","merge-sort","quick-sort","radix-sort","selection-sort","shell-sort"],"created_at":"2024-11-08T03:27:29.838Z","updated_at":"2026-02-03T06:30:18.094Z","avatar_url":"https://github.com/Kaoutherbo.png","language":"C","readme":"# Sorting Algorithms\n\n![](https://embed-ssl.wistia.com/deliveries/70d6f4e10e2badb5ef394f00c17ad2bc1c14f6e7.jpg)\n\n### AIM :sunflower:\n- At least four different sorting algorithms\n- What is the Big O notation, and how to evaluate the time complexity of an algorithm\n- How to select the best sorting algorithm for a given input\n- What is a stable sorting algorithm\n\n\n## Helper Files :raised_hands:\n\n* [print_array.c](./print_array.c): C function that prints an array of integers. \n* [print_list.c](./print_list.c): C function that prints a `listint_t` doubly-linked list. \n\n## Header Files :file_folder:\n\n* [sort.h](./sort.h): Header file containing definitions and prototypes for all types and functions written for the project.\n\nData Structure:\n```\ntypedef struct listint_s\n{\n\tconst int n;\n\tstruct listint_s *prev;\n\tstruct listint_s *next;\n} listint_t;\n```\n\nFunction Prototypes:\n\n| File                       | Prototype                                         |\n| -------------------------- | ------------------------------------------------- |\n| `print_array.c`            | `void print_array(const int *array, size_t size)` |\n| `print_list.c`             | `void print_list(const listint_t *list)`          |\n| `0-bubble_sort.c`          | `void bubble_sort(int *array, size_t size);`      |\n| `1-insertion_sort_list.c`  | `void insertion_sort_list(listint_t **list);`     |\n| `2-selection-sort.c`       | `void selection_sort(int *array, size_t size);`   |\n| `3-quick_sort.c`           | `void quick_sort(int *array, size_t size);`       |\n| `100-shell_sort.c`         | `void shell_sort(int *array, size_t size);`       |\n| `101-cocktail_sort_list.c` | `void cocktail_sort_list(listint_t **list);`      |\n| `102-counting_sort.c`      | `void counting_sort(int *array, size_t size);`    |\n| `103-merge_sort.c`         | `void merge_sort(int *array, size_t size);`       |\n| `104-heap_sort.c`          | `void heap_sort(int *array, size_t size);`        |\n| `105-radix_sort.c`         | `void radix_sort(int *array, size_t size);`       |\n| `106-bitonic_sort.c`       | `void bitonic_sort(int *array, size_t size);`     |\n| `107-quick_sort_hoare.c`   | `void quick_sort_hoare(int *array, size_t size);` |\n\n\n## Tasks :page_with_curl:\n\n* **0. Bubble sort**\n  * [0-bubble_sort.c](./0-bubble_sort.c): C function that sorts an array of integers in ascending order using the Bubble Sort algorithm.\n  * Prints the array after each swap.\n  * [0-O](./0-O): Text file containing the best, average, and worst case time complexities of the Bubble Sort algorithm, one per line.\n\n* **1. Insertion sort**\n  * [1-insertion_sort_list.c](./1-insertion_sort_list.c): C function that sorts a `listint_t` doubly-linked list of integers in ascending order using the\n  Insertion Sort algorithm.\n  * Prints the list after each swap.\n  * [1-O](./1-O): Text file containing the best, average, and worst case time complexities of the Insertion Sort algorithm, one per line.\n\n* **2. Selection sort**\n  * [2-selection_sort.c](./2-selection_sort.c): C function that sorts an array of integers in ascending order using the Selection Sort algorithm.\n  * Prints the array after each swap.\n  * [2-O](./2-O): Text file containing the best, average, and worst case time complexities of the Selection Sort algorithm, one per line.\n\n* **3. Quick sort**\n  * [3-quick_sort.c](./3-quick_sort.c): C function that sorts an array of integers in ascending order using the Quick Sort algorithm.\n  * Implements the Lomuto partition scheme.\n  * Always uses the last element of the partition being sorted as the pivot.\n  * Prints the array after each swap.\n  * [3-O](./3-O): Text file containing the best, average, and worst case time complexities of the Quick Sort Lomuto Partition scheme algorithm, one per line.\n\n* **4. Shell sort - Knuth Sequence**\n  * [100-shell_sort.c](./100-shell_sort.c): C function that sorts an array of integers in ascending order using the Shell sort algorithm.\n  * Implements the Knuth interval sequence.\n  * Prints the array each time the interval is decreased.\n\n* **5. Cocktail shaker sort**\n  * [101-cocktail_sort_list.c](./101-cocktail_sort_list.c): C function that sorts\n  a `listint_t` doubly-linked list of integers in ascending order using the Cocktail Shaker Sort algorithm.\n  * Prints the list after each swap.\n  * [101-O](./101-O): Text file containing the best, average, and worst case time complexities of the Cocktail Shaker Sort algorithm, one per line.\n\n* **6. Counting sort**\n  * [102-counting_sort.c](./102-counting_sort.c): C function that sorts an array of integers in ascending order using the Counting Sort algorithm.\n  * Assumes that the array will only contain numbers `\u003e= 0`.\n  * Prints the counting array after it has been initialized.\n  * [102-O](./102-O): Text file containing the best, average, and worst case time complexities of the Counting Sort algorithm, one per line.\n\n* **7. Merge sort**\n  * [103-merge_sort.c](./103-merge_sort.c): C function that sorts an array of integers in ascending order using the Merge Sort algorithm.\n  * Implements the `top-down` Merge Sort algorithm.\n    * When an array is divided, the size of the left subarray is always less than or equal to the size of the right subarray.\n    * Always sorts the left subarray before the right one.\n  * Prints subarrays each time they are merged.\n  * [103-O](./103-O): Text file containing the best, average, and worst case time complexities of the Merge Sort algorithm, one per line.\n\n* **8. Heap sort**\n  * [104-heap_sort.c](./104-heap_sort.c): C function that sorts an array of integers in ascending order using the Heap Sort algorithm.\n  * Implements the `sift-down` Heap Sort algorithm.\n  * Prints the array after each swap.\n  * [104-O](./104-O): Text file containing the best, average, and worst case time complexiites of the Heap Sort algorithm, one per line.\n\n* **9. Radix sort**\n  * [105-radix_sort.c](./105-radix_sort.c): C function that sorts an array of integers in ascending order using the Radix Sort algorithm.\n  * Implements the Least-Significant-Digit (LSD) Radix Sort algorithm.\n  * Assumes that the array will only contain numbers `\u003e= 0`.\n  * Prints the array for each significant digit increase.\n  * [105-O](./105-O): Text file containing the best, average, and worst case time complexities of the Radix Sort algorithm, one per line.\n\n* **10. Bitonic sort**\n  * [106-bitonic_sort.c](./106-bitonic_sort.c): C function that sorts an array of integers in ascending order using the Bitonic Sort algorithm.\n  * Assumes that `size` is a power of 2 (ie. `size` can be expressed as `2^k` where `k \u003e= 0`).\n  * Prints subarrays each time they are merged.\n  * [106-O](./106-O): Text file containing the best, average, and worst case time complexities of the Bitonic Sort algorithm, one per line.\n\n* **11. Quick Sort - Hoare Partition scheme**\n  * [107-quick_sort_hoare.c](./107-quick_sort_hoare.c): C function that sorts an array of integers in ascending order using the Quick Sort algorithm.\n  * Implements the Hoare partition scheme.\n  * Always uses the last elemement of the partition being sorted as the pivot.\n  * Prints the array after each swap.\n  * [107-O](./107-O): Text file containing the best, average, and worst case time complexities of the Quick Sort Hoare Partition cheme algorithm, one per line.\n\n* **12. Dealer**\n  * [1000-sort_deck.c](./1000-sort_deck.c): C function that sorts a `deck_node_t` doubly-linked list deck of cards.\n  * Assumes that there are exactly `52` elements in the doubly-linked list.\n  * Orders the deck from spades to diamonds and from aces to kings.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaoutherbo%2Fsorting_algorithms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaoutherbo%2Fsorting_algorithms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaoutherbo%2Fsorting_algorithms/lists"}