Created
December 7, 2011 02:53
-
-
Save b-adams/1441223 to your computer and use it in GitHub Desktop.
Final Program Sample Output
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
eclipse:cs131 badams$ clang cs131_program_final_badams.c -o bubblesort | |
eclipse:cs131 badams$ ./bubblesort | |
Bad syntax. Instead try: | |
./bubblesort 3 1 4 1 5 9 2 6 5 3 5 7 | |
Or... | |
./bubblesort verbose 3 1 4 1 5 9 2 6 5 3 5 7 | |
eclipse:cs131 badams$ |
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
eclipse:cs131 badams$ clang cs131_program_final_badams.c -o bubblesort | |
eclipse:cs131 badams$ ./bubblesort 9 7 5 3 1 10 8 6 4 2 | |
1 2 3 4 5 6 7 8 9 10 | |
eclipse:cs131 badams$ |
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
eclipse:cs131 badams$ clang cs131_program_final_badams.c -o bubblesort | |
eclipse:cs131 badams$ ./bubblesort v 9 7 5 3 1 10 8 6 4 2 | |
Running in verbose mode. | |
Sorting array... | |
Checking order... Index 0(9) and 1(7) out of order. | |
9 7 5 3 1 10 8 6 4 2 | |
Bubbling up... | |
0: Swapping 9 after 7 | |
1: Swapping 9 after 5 | |
2: Swapping 9 after 3 | |
3: Swapping 9 after 1 | |
4: | |
5: Swapping 10 after 8 | |
6: Swapping 10 after 6 | |
7: Swapping 10 after 4 | |
8: Swapping 10 after 2 | |
...done bubbling. | |
Checking order... Index 0(7) and 1(5) out of order. | |
7 5 3 1 9 8 6 4 2 10 | |
Bubbling up... | |
0: Swapping 7 after 5 | |
1: Swapping 7 after 3 | |
2: Swapping 7 after 1 | |
3: | |
4: Swapping 9 after 8 | |
5: Swapping 9 after 6 | |
6: Swapping 9 after 4 | |
7: Swapping 9 after 2 | |
8: | |
...done bubbling. | |
Checking order... Index 0(5) and 1(3) out of order. | |
5 3 1 7 8 6 4 2 9 10 | |
Bubbling up... | |
0: Swapping 5 after 3 | |
1: Swapping 5 after 1 | |
2: | |
3: | |
4: Swapping 8 after 6 | |
5: Swapping 8 after 4 | |
6: Swapping 8 after 2 | |
7: | |
8: | |
...done bubbling. | |
Checking order... Index 0(3) and 1(1) out of order. | |
3 1 5 7 6 4 2 8 9 10 | |
Bubbling up... | |
0: Swapping 3 after 1 | |
1: | |
2: | |
3: Swapping 7 after 6 | |
4: Swapping 7 after 4 | |
5: Swapping 7 after 2 | |
6: | |
7: | |
8: | |
...done bubbling. | |
Checking order... Index 3(6) and 4(4) out of order. | |
1 3 5 6 4 2 7 8 9 10 | |
Bubbling up... | |
0: | |
1: | |
2: | |
3: Swapping 6 after 4 | |
4: Swapping 6 after 2 | |
5: | |
6: | |
7: | |
8: | |
...done bubbling. | |
Checking order... Index 2(5) and 3(4) out of order. | |
1 3 5 4 2 6 7 8 9 10 | |
Bubbling up... | |
0: | |
1: | |
2: Swapping 5 after 4 | |
3: Swapping 5 after 2 | |
4: | |
5: | |
6: | |
7: | |
8: | |
...done bubbling. | |
Checking order... Index 2(4) and 3(2) out of order. | |
1 3 4 2 5 6 7 8 9 10 | |
Bubbling up... | |
0: | |
1: | |
2: Swapping 4 after 2 | |
3: | |
4: | |
5: | |
6: | |
7: | |
8: | |
...done bubbling. | |
Checking order... Index 1(3) and 2(2) out of order. | |
1 3 2 4 5 6 7 8 9 10 | |
Bubbling up... | |
0: | |
1: Swapping 3 after 2 | |
2: | |
3: | |
4: | |
5: | |
6: | |
7: | |
8: | |
...done bubbling. | |
Checking order... The whole array is in order. | |
...done sorting | |
1 2 3 4 5 6 7 8 9 10 | |
That required 30 swaps. | |
eclipse:cs131 badams$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment