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

Merge sort #12

Open ObamtechNetworks opened 11 months ago

ObamtechNetworks commented 11 months ago

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

Prototype: void merge_sort(int *array, size_t size); You must implement the top-down merge sort algorithm When you divide an array into two sub-arrays, the size of the left array should always be <= the size of the right array. i.e. {1, 2, 3, 4, 5} -> {1, 2}, {3, 4, 5} Sort the left array before the right array You are allowed to use printf You are allowed to use malloc and free only once (only one call) Output: see example Write in the file 103-O, the big O notations of the time complexity of the Merge sort algorithm, with 1 notation per line:

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