Created
January 8, 2016 02:09
-
-
Save twof/88578aab8861d6c24340 to your computer and use it in GitHub Desktop.
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
while(sorted != true){ | |
for (int i=0; i<SIZE-1; i++){ | |
if (SortableArray[i]>SortableArray[i+1]) { | |
temp = SortableArray[i]; | |
SortableArray[i] = SortableArray[i+1]; | |
SortableArray[i+1]=temp; | |
}else{ | |
counter++; //every time a set is in order, add one to counter | |
} | |
} | |
if (counter == SIZE-1) { //if everything is in order, sorted is true | |
sorted=true; | |
}else{ | |
counter=0; //otherwise, return it to 0 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment