Last active
January 11, 2016 02:15
-
-
Save thanhnguyentang/146f61250acf9de08952 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| BUBBLE-SORT(A) | |
| // repeatedly swap two adjacent elements that are out of order | |
| for i = 1 to A.length() - 1 | |
| for j = A.length down to i+1 | |
| if A[j] < A[j-1] | |
| swap(A[j], A[j-1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment