Skip to content

Instantly share code, notes, and snippets.

@twof
Created April 30, 2016 23:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twof/fc9b102fa2f25e2311ab19a172f1419c to your computer and use it in GitHub Desktop.
Save twof/fc9b102fa2f25e2311ab19a172f1419c to your computer and use it in GitHub Desktop.
bool sorted = false;
while(!sorted){
sorted = true;
for (int i=startIndex; i<SIZE-startIndex-1; ++i){
if (sortableArray[i]>sortableArray[i+1]) {
swap(i, i+1, sortableArray);
sorted = false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment