Skip to content

Instantly share code, notes, and snippets.

@yujuwon
Created June 12, 2013 01:03
Show Gist options
  • Select an option

  • Save yujuwon/5762177 to your computer and use it in GitHub Desktop.

Select an option

Save yujuwon/5762177 to your computer and use it in GitHub Desktop.
int main(){
const int itemSize = 5;
int array[itemSize] = {3, 8, 0, 1, 4};
int i = 0; j = 0;
bool noChange = true;
for(i = itemSize-1; i > 0; i--){
noChange = true;
for(j = 0; j < i; j++){
if(array[j] > array[j+1]){
swap(array[j], array[j+1]);
noChange = false;
}
}
if(noChange)
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment