/sorting_algorithms

Sorting algorithms & Big O

Primary LanguageC

0-bubble_sort.c

  • Function that sorts an array of integers in ascending order using the Bubble sort algorithm
    • Prototype: void bubble_sort(int *array, size_t size);
    • Print the array after each time you swap two element
  • Write in the file 0-O, the big O notations of the time complexity of the Bubble sort algorithm, with 1 notation per line:
    • in the best case
    • in the average case
    • in the worst case

1-insertion_sort_list.c

  • Function that sorts a doubly linked list of integers in ascending order using the Insertion sort algorithm
    • Prototype: void insertion_sort_list(listint_t **list);
    • Not allowed to modify the integer n of a node. You have to swap the nodes themselves.
    • Print the list after each time you swap two elements
  • Write in the file 1-O, the big O notations of the time complexity of the Insertion sort algorithm, with 1 notation per line:
    • in the best case
    • in the average case
    • in the worst case

2-selection_sort.c

  • Function that sorts an array of integers in ascending order using the Selection sort algorithm
    • Prototype: void selection_sort(int *array, size_t size);
    • Print the array after each time you swap two elements
  • Write in the file 2-O, the big O notations of the time complexity of the Selection sort algorithm, with 1 notation per line:
    • in the best case
    • in the average case
    • in the worst case

3-quick_sort.c

  • Function that sorts an array of integers in ascending order using the Quick sort algorithm
    • Prototype: void quick_sort(int *array, size_t size);
    • You must implement the Lomuto partition scheme.
    • The pivot should always be the last element of the partition being sorted.
    • Print the array after each time you swap two elements
  • Write in the file 3-O, the big O notations of the time complexity of the Quick sort algorithm, with 1 notation per line:
    • in the best case
    • in the average case
    • in the worst case