Selection Sort#47
Conversation
|
Please merge this commit |
There was a problem hiding this comment.
Hi @Shivani-001
Thank you for your contribution.
Can you please add insertion sort in C?
someone else already added selection sort.
Please reply here if you wants to work on insertion sort?
|
Ok I will add insertion sort in c. |
khagapati-bagh
left a comment
There was a problem hiding this comment.
Hi @Shivani-001, Thank you for your contribution.
Here are some comments on your code.
- Please follow all the rules which are applicable to your code from contribution guidelines and modify accordingly.
- Format your code with the formatter mentioned in the contribution guide
| @@ -0,0 +1,43 @@ | |||
| // C program for insertion sort | |||
| #include <math.h> | |||
There was a problem hiding this comment.
Remove this include it's not required
| void printArray(int arr[], int n) | ||
| { | ||
| int i; | ||
| for (i = 0; i < n; i++) |
There was a problem hiding this comment.
you can directly use for (int i = 0; i < n; i++) add a block { }
| /* Driver program to test insertion sort */ | ||
| int main() | ||
| { | ||
| int arr[] = { 12, 11, 13, 5, 6 }; |
There was a problem hiding this comment.
after formating your code with the online formatter. make sure your array should be as it is int arr[] = { 12, 11, 13, 5, 6 };
Done selection sort in c language.