ObamtechNetworks / sorting_algorithms

A collaborative project about learning the different kinds of the sorting algorithms, Big O notation, time and space complexities and how to implement them
1 stars 0 forks source link

Counting sort #11

Closed ObamtechNetworks closed 9 months ago

ObamtechNetworks commented 9 months ago

Write a function that sorts an array of integers in ascending order using the Counting sort algorithm

Prototype: void counting_sort(int *array, size_t size); You can assume that array will contain only numbers >= 0 You are allowed to use malloc and free for this task You’re expected to print your counting array once it is set up (See example below) This array is of size k + 1 where k is the largest number in array Write in the file 102-O, the big O notations of the time complexity of the Counting sort algorithm, with 1 notation per line:

in the best case in the average case in the worst case