Skip to content

Commit

Permalink
Merge pull request AdarshAddee#123 from PradeepKhatri/main
Browse files Browse the repository at this point in the history
Implement Bubble Sort
  • Loading branch information
AdarshAddee committed Oct 4, 2022
2 parents 79ea1ce + 0235b01 commit 6b93a4c
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 7 deletions.
40 changes: 40 additions & 0 deletions C/BubbleSort.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// PradeepKhatri - https://github.com/PradeepKhatri

#include <stdio.h>

void printArray(int *A,int n)
{
for(int i=0;i<n;i++)
{
printf("%d ",A[i]);
}
printf("\n");
}

void BubbleSort(int *A,int n)
{
int temp;
for(int i=0;i<n-1;i++)
{
for(int j=0;j<n-i-1;j++)
{
if(A[j] > A[j+1])
{
temp = A[j];
A[j] = A[j+1];
A[j+1] = temp;
}
}
}
}

int main()
{
int A[] = {5,7,3,1,2};
int n = 5;
printArray(A,n);
BubbleSort(A,n);
printArray(A,n);

}

17 changes: 10 additions & 7 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,18 @@
| Aditya Wadkar | <a href="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/AdityaWadkar">Aditya Wadkar</a> | <a href="mailto:[email protected]">E-Mail</a> |
| Rahul Jangle | <a href="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/Rronny01/">Ronny</a> | <a href="mailto:[email protected]">E-Mail</a> |
| Anurag Vats | <a href="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/AnuragVats007">Anurag Vats</a> | <a href="mailto:[email protected]">E-Mail</a> |
| Daksh Kesarwani | <a href="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/InnocentDaksh63">Daksh kesaarwani</a> | <a href="mailto:[email protected]">E-Mail</a> |
| Pradeep Khatri | <a href="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/PradeepKhatri">Pradeep Khatri</a> | <a href="mailto:[email protected]">E-Mail</a> |
| Apurva Dubey | <a href="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/umbridge">umbridge</a> | <a href="mailto:[email protected]">E-Mail</a> |
| Daksh Kesarwani | <a href="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/InnocentDaksh63">Daksh kesaarwani</a> | <a href="[email protected]">E-Mail</a> |
| Chirag Chandnani | <a href="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/chiragchandnani10">Chirag Chandnani</a> | <a href="[email protected]">E-Mail</a> |
| Shivam Jaiswal | <a href="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/Shivaminc">Shivam Jaiswal</a> | <a href="[email protected]">E-mail</a> |
| Ashish Kushwaha | <a href="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/AshishKingdom">Ashish Kushwaha</a> | <a href="[email protected]">E-Mail</a> |
| Daksh Kesarwani | <a href="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/InnocentDaksh63">Daksh kesaarwani</a> | <a href="mailto:[email protected]">E-Mail</a> |
| Chirag Chandnani | <a href="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/chiragchandnani10">Chirag Chandnani</a> | <a href="mailto:[email protected]">E-Mail</a> |
| Shivam Jaiswal | <a href="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/Shivaminc">Shivam Jaiswal</a> | <a href="mailto:[email protected]">E-mail</a> |
| Ashish Kushwaha | <a href="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/AshishKingdom">Ashish Kushwaha</a> | <a href="mailto:[email protected]">E-Mail</a> |
| Dhruv Arora | <a href="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/lord-benjamin">Dhruv Arora</a> | <a href="mailto:[email protected]">E-Mail</a> |
| Tharindu Sooriyaarchchi | <a href="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/TharinduDilshan>Tharindu Sooriyaarchchi</a> | <a href="[email protected]">E-Mail</a> |
| Samriddh Prasad | <a href="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/Samriddh2703">Samriddh Prasad</a> | <a href="[email protected]">E-Mail</a> |
| Edgar Gonzalez | <a href="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/Edgarzerocool">Edgar Gonzalez</a> | <a href="[email protected]">E-Mail</a> |
| Tharindu Sooriyaarchchi | <a href="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/TharinduDilshan>Tharindu Sooriyaarchchi</a> | <a href="mailto:[email protected]">E-Mail</a> |
| Samriddh Prasad | <a href="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/Samriddh2703">Samriddh Prasad</a> | <a href="mailto:[email protected]">E-Mail</a> |
| Edgar Gonzalez | <a href="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/Edgarzerocool">Edgar Gonzalez</a> | <a href="mailto:[email protected]">E-Mail</a> |




Expand Down

0 comments on commit 6b93a4c

Please sign in to comment.