Skip to content

Commit b2d67f0

Browse files
author
CheerfulBear22
committed
Added comments to slow_sort.c
1 parent cd59b18 commit b2d67f0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

sorting/slow_sort.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <stdlib.h>
33
#include <time.h>
44

5+
/*Displays array passed as parameter*/
56
void display(int arr[], int size)
67
{
78
for(int i = 0; i < size; i++)
@@ -12,13 +13,20 @@ void display(int arr[], int size)
1213
printf("\n");
1314
}
1415

16+
/*Swaps the two values passed to the function*/
1517
void swap(int *num1, int *num2)
1618
{
1719
int temp = *num1;
1820
*num1 = *num2;
1921
*num2 = *num1;
2022
}
2123

24+
/*
25+
Slow sort function
26+
@param arr The array to be sorted
27+
@param low The starting index
28+
@param high The ending index
29+
*/
2230
void slowsort(int arr[], int low, int high)
2331
{
2432
if (low >= high)
@@ -35,6 +43,7 @@ void slowsort(int arr[], int low, int high)
3543
slowsort(arr, low, high - 1);
3644
}
3745

46+
/*Test function*/
3847
void test()
3948
{
4049
const int size = 20;

0 commit comments

Comments
 (0)