Skip to content

Selection Sort#47

Open
Shivani-001 wants to merge 4 commits into
khagapati-bagh:mainfrom
Shivani-001:main
Open

Selection Sort#47
Shivani-001 wants to merge 4 commits into
khagapati-bagh:mainfrom
Shivani-001:main

Conversation

@Shivani-001
Copy link
Copy Markdown

Done selection sort in c language.

@Shivani-001
Copy link
Copy Markdown
Author

Please merge this commit

Copy link
Copy Markdown
Owner

@khagapati-bagh khagapati-bagh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@Shivani-001
Copy link
Copy Markdown
Author

Ok I will add insertion sort in c.

Copy link
Copy Markdown
Owner

@khagapati-bagh khagapati-bagh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Shivani-001, Thank you for your contribution.

Here are some comments on your code.

  1. Please follow all the rules which are applicable to your code from contribution guidelines and modify accordingly.
  2. Format your code with the formatter mentioned in the contribution guide

@@ -0,0 +1,43 @@
// C program for insertion sort
#include <math.h>
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this include it's not required

void printArray(int arr[], int n)
{
int i;
for (i = 0; i < n; i++)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 };
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after formating your code with the online formatter. make sure your array should be as it is int arr[] = { 12, 11, 13, 5, 6 };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants