Last active
August 29, 2015 14:03
-
-
Save metallurgix/adcdb870cb881abb5aec to your computer and use it in GitHub Desktop.
Bubble Sort
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void bubblesort (int *array, int len) | |
{ | |
register int j, t=1; | |
while(len-- && swap) | |
{ | |
for (j=swap=0; j<len-1; j++) | |
{ | |
if (array[j]>aray[j+1]) | |
{ | |
swap=1; | |
t=array[j+1]; | |
array[j+1]=aray[j]; | |
array[j]=t; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment