mirror of
https://github.com/TheAlgorithms/C
synced 2024-11-25 06:49:36 +03:00
Apply suggestions from code review
Co-authored-by: David Leal <halfpacho@gmail.com>
This commit is contained in:
parent
de09c966b3
commit
cf95c1e27a
@ -5,6 +5,9 @@
|
||||
* worst-case: O(n^2)
|
||||
* best-case: O(n)
|
||||
* average-complexity: O(n^2)
|
||||
|
||||
* @author Unknown author
|
||||
* @author [Gabriel Fioravante](https://github.com/northernSage)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -15,10 +18,11 @@
|
||||
#define MAX 20
|
||||
|
||||
/**
|
||||
* Bubble sort implementation
|
||||
* @brief Bubble sort implementation
|
||||
* @param array_sort the array to be sorted
|
||||
* @returns void
|
||||
*/
|
||||
void bubblesort(int* array_sort)
|
||||
void bubble_sort(int* array_sort)
|
||||
{
|
||||
bool is_sorted = false;
|
||||
|
||||
@ -49,7 +53,7 @@ void bubblesort(int* array_sort)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Test function
|
||||
* @brief Test implementations
|
||||
* @returns void
|
||||
*/
|
||||
static void test() {
|
||||
@ -64,7 +68,7 @@ static void test() {
|
||||
}
|
||||
|
||||
/* sort array */
|
||||
bubblesort(array_sort);
|
||||
bubble_sort(array_sort);
|
||||
|
||||
/* check if array ir correctly ordered */
|
||||
for (int i = 0; i < MAX - 1; i++)
|
||||
@ -79,6 +83,6 @@ static void test() {
|
||||
*/
|
||||
int main()
|
||||
{
|
||||
test(); // call test routine
|
||||
test(); // run self-test implementations
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user