Created
September 3, 2026 15:12
-
-
Save gregglind/12f0c6a5d4fd24339161bb5fa9d659a6 to your computer and use it in GitHub Desktop.
I Can't Believe It Sorts
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
| # "i cant believe it sorts" | |
| import random | |
| arr1 = list("abcdefg") | |
| print(arr1) | |
| random.shuffle(arr1) | |
| print (f"shuffled: {arr1}") | |
| def icbsort(arr): | |
| n = len(arr) | |
| for ii in range(n): | |
| print(f"outer loop {ii} {arr}") | |
| for jj in range(n): | |
| ai, aj = arr[ii], arr[jj] | |
| if ai < aj: | |
| print (f" swapping: {ii}, {jj}, {ai}, {aj}") | |
| arr[ii] = aj | |
| arr[jj] = ai | |
| print(arr) | |
| return (arr) | |
| print("RANDOM ORDER") | |
| icbsort(arr1) | |
| #print("REVERSE ORDER") | |
| #icbsort(list(reversed(sorted(arr1)))) |
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
| ['a', 'b', 'c', 'd', 'e', 'f', 'g'] | |
| shuffled: ['c', 'f', 'g', 'e', 'd', 'a', 'b'] | |
| outer loop 0 ['c', 'f', 'g', 'e', 'd', 'a', 'b'] | |
| swapping: 0, 1, c, f | |
| ['f', 'c', 'g', 'e', 'd', 'a', 'b'] | |
| swapping: 0, 2, f, g | |
| ['g', 'c', 'f', 'e', 'd', 'a', 'b'] | |
| outer loop 1 ['g', 'c', 'f', 'e', 'd', 'a', 'b'] | |
| swapping: 1, 0, c, g | |
| ['c', 'g', 'f', 'e', 'd', 'a', 'b'] | |
| outer loop 2 ['c', 'g', 'f', 'e', 'd', 'a', 'b'] | |
| swapping: 2, 1, f, g | |
| ['c', 'f', 'g', 'e', 'd', 'a', 'b'] | |
| outer loop 3 ['c', 'f', 'g', 'e', 'd', 'a', 'b'] | |
| swapping: 3, 1, e, f | |
| ['c', 'e', 'g', 'f', 'd', 'a', 'b'] | |
| swapping: 3, 2, f, g | |
| ['c', 'e', 'f', 'g', 'd', 'a', 'b'] | |
| outer loop 4 ['c', 'e', 'f', 'g', 'd', 'a', 'b'] | |
| swapping: 4, 1, d, e | |
| ['c', 'd', 'f', 'g', 'e', 'a', 'b'] | |
| swapping: 4, 2, e, f | |
| ['c', 'd', 'e', 'g', 'f', 'a', 'b'] | |
| swapping: 4, 3, f, g | |
| ['c', 'd', 'e', 'f', 'g', 'a', 'b'] | |
| outer loop 5 ['c', 'd', 'e', 'f', 'g', 'a', 'b'] | |
| swapping: 5, 0, a, c | |
| ['a', 'd', 'e', 'f', 'g', 'c', 'b'] | |
| swapping: 5, 1, c, d | |
| ['a', 'c', 'e', 'f', 'g', 'd', 'b'] | |
| swapping: 5, 2, d, e | |
| ['a', 'c', 'd', 'f', 'g', 'e', 'b'] | |
| swapping: 5, 3, e, f | |
| ['a', 'c', 'd', 'e', 'g', 'f', 'b'] | |
| swapping: 5, 4, f, g | |
| ['a', 'c', 'd', 'e', 'f', 'g', 'b'] | |
| outer loop 6 ['a', 'c', 'd', 'e', 'f', 'g', 'b'] | |
| swapping: 6, 1, b, c | |
| ['a', 'b', 'd', 'e', 'f', 'g', 'c'] | |
| swapping: 6, 2, c, d | |
| ['a', 'b', 'c', 'e', 'f', 'g', 'd'] | |
| swapping: 6, 3, d, e | |
| ['a', 'b', 'c', 'd', 'f', 'g', 'e'] | |
| swapping: 6, 4, e, f | |
| ['a', 'b', 'c', 'd', 'e', 'g', 'f'] | |
| swapping: 6, 5, f, g | |
| ['a', 'b', 'c', 'd', 'e', 'f', 'g'] | |
| ['a', 'b', 'c', 'd', 'e', 'f', 'g'] | |
| ['a', 'b', 'c', 'd', 'e', 'f', 'g'] | |
| shuffled: ['f', 'c', 'd', 'e', 'b', 'g', 'a'] | |
| RANDOM ORDER | |
| outer loop 0 ['f', 'c', 'd', 'e', 'b', 'g', 'a'] | |
| swapping: 0, 5, f, g | |
| ['g', 'c', 'd', 'e', 'b', 'f', 'a'] | |
| outer loop 1 ['g', 'c', 'd', 'e', 'b', 'f', 'a'] | |
| swapping: 1, 0, c, g | |
| ['c', 'g', 'd', 'e', 'b', 'f', 'a'] | |
| outer loop 2 ['c', 'g', 'd', 'e', 'b', 'f', 'a'] | |
| swapping: 2, 1, d, g | |
| ['c', 'd', 'g', 'e', 'b', 'f', 'a'] | |
| outer loop 3 ['c', 'd', 'g', 'e', 'b', 'f', 'a'] | |
| swapping: 3, 2, e, g | |
| ['c', 'd', 'e', 'g', 'b', 'f', 'a'] | |
| outer loop 4 ['c', 'd', 'e', 'g', 'b', 'f', 'a'] | |
| swapping: 4, 0, b, c | |
| ['b', 'd', 'e', 'g', 'c', 'f', 'a'] | |
| swapping: 4, 1, c, d | |
| ['b', 'c', 'e', 'g', 'd', 'f', 'a'] | |
| swapping: 4, 2, d, e | |
| ['b', 'c', 'd', 'g', 'e', 'f', 'a'] | |
| swapping: 4, 3, e, g | |
| ['b', 'c', 'd', 'e', 'g', 'f', 'a'] | |
| outer loop 5 ['b', 'c', 'd', 'e', 'g', 'f', 'a'] | |
| swapping: 5, 4, f, g | |
| ['b', 'c', 'd', 'e', 'f', 'g', 'a'] | |
| outer loop 6 ['b', 'c', 'd', 'e', 'f', 'g', 'a'] | |
| swapping: 6, 0, a, b | |
| ['a', 'c', 'd', 'e', 'f', 'g', 'b'] | |
| swapping: 6, 1, b, c | |
| ['a', 'b', 'd', 'e', 'f', 'g', 'c'] | |
| swapping: 6, 2, c, d | |
| ['a', 'b', 'c', 'e', 'f', 'g', 'd'] | |
| swapping: 6, 3, d, e | |
| ['a', 'b', 'c', 'd', 'f', 'g', 'e'] | |
| swapping: 6, 4, e, f | |
| ['a', 'b', 'c', 'd', 'e', 'g', 'f'] | |
| swapping: 6, 5, f, g | |
| ['a', 'b', 'c', 'd', 'e', 'f', 'g'] | |
| REVERSE ORDER | |
| Traceback (most recent call last): | |
| File "/lib/python312.zip/_pyodide/_base.py", line 597, in eval_code_async | |
| await CodeRunner( | |
| File "/lib/python312.zip/_pyodide/_base.py", line 411, in run_async | |
| coroutine = eval(self.code, globals, locals) | |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| File "<exec>", line 26, in <module> | |
| NameError: name 'revers' is not defined. Did you mean: 'reversed'? | |
| ['a', 'b', 'c', 'd', 'e', 'f', 'g'] | |
| shuffled: ['d', 'a', 'e', 'g', 'f', 'c', 'b'] | |
| RANDOM ORDER | |
| outer loop 0 ['d', 'a', 'e', 'g', 'f', 'c', 'b'] | |
| swapping: 0, 2, d, e | |
| ['e', 'a', 'd', 'g', 'f', 'c', 'b'] | |
| swapping: 0, 3, e, g | |
| ['g', 'a', 'd', 'e', 'f', 'c', 'b'] | |
| outer loop 1 ['g', 'a', 'd', 'e', 'f', 'c', 'b'] | |
| swapping: 1, 0, a, g | |
| ['a', 'g', 'd', 'e', 'f', 'c', 'b'] | |
| outer loop 2 ['a', 'g', 'd', 'e', 'f', 'c', 'b'] | |
| swapping: 2, 1, d, g | |
| ['a', 'd', 'g', 'e', 'f', 'c', 'b'] | |
| outer loop 3 ['a', 'd', 'g', 'e', 'f', 'c', 'b'] | |
| swapping: 3, 2, e, g | |
| ['a', 'd', 'e', 'g', 'f', 'c', 'b'] | |
| outer loop 4 ['a', 'd', 'e', 'g', 'f', 'c', 'b'] | |
| swapping: 4, 3, f, g | |
| ['a', 'd', 'e', 'f', 'g', 'c', 'b'] | |
| outer loop 5 ['a', 'd', 'e', 'f', 'g', 'c', 'b'] | |
| swapping: 5, 1, c, d | |
| ['a', 'c', 'e', 'f', 'g', 'd', 'b'] | |
| swapping: 5, 2, d, e | |
| ['a', 'c', 'd', 'f', 'g', 'e', 'b'] | |
| swapping: 5, 3, e, f | |
| ['a', 'c', 'd', 'e', 'g', 'f', 'b'] | |
| swapping: 5, 4, f, g | |
| ['a', 'c', 'd', 'e', 'f', 'g', 'b'] | |
| outer loop 6 ['a', 'c', 'd', 'e', 'f', 'g', 'b'] | |
| swapping: 6, 1, b, c | |
| ['a', 'b', 'd', 'e', 'f', 'g', 'c'] | |
| swapping: 6, 2, c, d | |
| ['a', 'b', 'c', 'e', 'f', 'g', 'd'] | |
| swapping: 6, 3, d, e | |
| ['a', 'b', 'c', 'd', 'f', 'g', 'e'] | |
| swapping: 6, 4, e, f | |
| ['a', 'b', 'c', 'd', 'e', 'g', 'f'] | |
| swapping: 6, 5, f, g | |
| ['a', 'b', 'c', 'd', 'e', 'f', 'g'] | |
| REVERSE ORDER | |
| Traceback (most recent call last): | |
| File "/lib/python312.zip/_pyodide/_base.py", line 597, in eval_code_async | |
| await CodeRunner( | |
| File "/lib/python312.zip/_pyodide/_base.py", line 411, in run_async | |
| coroutine = eval(self.code, globals, locals) | |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| File "<exec>", line 26, in <module> | |
| NameError: name 'sort' is not defined | |
| ['a', 'b', 'c', 'd', 'e', 'f', 'g'] | |
| shuffled: ['a', 'c', 'g', 'f', 'd', 'b', 'e'] | |
| RANDOM ORDER | |
| outer loop 0 ['a', 'c', 'g', 'f', 'd', 'b', 'e'] | |
| swapping: 0, 1, a, c | |
| ['c', 'a', 'g', 'f', 'd', 'b', 'e'] | |
| swapping: 0, 2, c, g | |
| ['g', 'a', 'c', 'f', 'd', 'b', 'e'] | |
| outer loop 1 ['g', 'a', 'c', 'f', 'd', 'b', 'e'] | |
| swapping: 1, 0, a, g | |
| ['a', 'g', 'c', 'f', 'd', 'b', 'e'] | |
| outer loop 2 ['a', 'g', 'c', 'f', 'd', 'b', 'e'] | |
| swapping: 2, 1, c, g | |
| ['a', 'c', 'g', 'f', 'd', 'b', 'e'] | |
| outer loop 3 ['a', 'c', 'g', 'f', 'd', 'b', 'e'] | |
| swapping: 3, 2, f, g | |
| ['a', 'c', 'f', 'g', 'd', 'b', 'e'] | |
| outer loop 4 ['a', 'c', 'f', 'g', 'd', 'b', 'e'] | |
| swapping: 4, 2, d, f | |
| ['a', 'c', 'd', 'g', 'f', 'b', 'e'] | |
| swapping: 4, 3, f, g | |
| ['a', 'c', 'd', 'f', 'g', 'b', 'e'] | |
| outer loop 5 ['a', 'c', 'd', 'f', 'g', 'b', 'e'] | |
| swapping: 5, 1, b, c | |
| ['a', 'b', 'd', 'f', 'g', 'c', 'e'] | |
| swapping: 5, 2, c, d | |
| ['a', 'b', 'c', 'f', 'g', 'd', 'e'] | |
| swapping: 5, 3, d, f | |
| ['a', 'b', 'c', 'd', 'g', 'f', 'e'] | |
| swapping: 5, 4, f, g | |
| ['a', 'b', 'c', 'd', 'f', 'g', 'e'] | |
| outer loop 6 ['a', 'b', 'c', 'd', 'f', 'g', 'e'] | |
| swapping: 6, 4, e, f | |
| ['a', 'b', 'c', 'd', 'e', 'g', 'f'] | |
| swapping: 6, 5, f, g | |
| ['a', 'b', 'c', 'd', 'e', 'f', 'g'] | |
| REVERSE ORDER | |
| Traceback (most recent call last): | |
| File "/lib/python312.zip/_pyodide/_base.py", line 597, in eval_code_async | |
| await CodeRunner( | |
| File "/lib/python312.zip/_pyodide/_base.py", line 411, in run_async | |
| coroutine = eval(self.code, globals, locals) | |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| File "<exec>", line 26, in <module> | |
| File "<exec>", line 9, in icbsort | |
| TypeError: object of type 'list_reverseiterator' has no len() | |
| ['a', 'b', 'c', 'd', 'e', 'f', 'g'] | |
| shuffled: ['a', 'd', 'g', 'c', 'b', 'f', 'e'] | |
| RANDOM ORDER | |
| outer loop 0 ['a', 'd', 'g', 'c', 'b', 'f', 'e'] | |
| swapping: 0, 1, a, d | |
| ['d', 'a', 'g', 'c', 'b', 'f', 'e'] | |
| swapping: 0, 2, d, g | |
| ['g', 'a', 'd', 'c', 'b', 'f', 'e'] | |
| outer loop 1 ['g', 'a', 'd', 'c', 'b', 'f', 'e'] | |
| swapping: 1, 0, a, g | |
| ['a', 'g', 'd', 'c', 'b', 'f', 'e'] | |
| outer loop 2 ['a', 'g', 'd', 'c', 'b', 'f', 'e'] | |
| swapping: 2, 1, d, g | |
| ['a', 'd', 'g', 'c', 'b', 'f', 'e'] | |
| outer loop 3 ['a', 'd', 'g', 'c', 'b', 'f', 'e'] | |
| swapping: 3, 1, c, d | |
| ['a', 'c', 'g', 'd', 'b', 'f', 'e'] | |
| swapping: 3, 2, d, g | |
| ['a', 'c', 'd', 'g', 'b', 'f', 'e'] | |
| outer loop 4 ['a', 'c', 'd', 'g', 'b', 'f', 'e'] | |
| swapping: 4, 1, b, c | |
| ['a', 'b', 'd', 'g', 'c', 'f', 'e'] | |
| swapping: 4, 2, c, d | |
| ['a', 'b', 'c', 'g', 'd', 'f', 'e'] | |
| swapping: 4, 3, d, g | |
| ['a', 'b', 'c', 'd', 'g', 'f', 'e'] | |
| outer loop 5 ['a', 'b', 'c', 'd', 'g', 'f', 'e'] | |
| swapping: 5, 4, f, g | |
| ['a', 'b', 'c', 'd', 'f', 'g', 'e'] | |
| outer loop 6 ['a', 'b', 'c', 'd', 'f', 'g', 'e'] | |
| swapping: 6, 4, e, f | |
| ['a', 'b', 'c', 'd', 'e', 'g', 'f'] | |
| swapping: 6, 5, f, g | |
| ['a', 'b', 'c', 'd', 'e', 'f', 'g'] | |
| REVERSE ORDER | |
| Traceback (most recent call last): | |
| File "/lib/python312.zip/_pyodide/_base.py", line 597, in eval_code_async | |
| await CodeRunner( | |
| File "/lib/python312.zip/_pyodide/_base.py", line 411, in run_async | |
| coroutine = eval(self.code, globals, locals) | |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| File "<exec>", line 26, in <module> | |
| File "<exec>", line 9, in icbsort | |
| TypeError: object of type 'list_reverseiterator' has no len() | |
| ['a', 'b', 'c', 'd', 'e', 'f', 'g'] | |
| shuffled: ['c', 'a', 'b', 'f', 'd', 'g', 'e'] | |
| RANDOM ORDER | |
| outer loop 0 ['c', 'a', 'b', 'f', 'd', 'g', 'e'] | |
| swapping: 0, 3, c, f | |
| ['f', 'a', 'b', 'c', 'd', 'g', 'e'] | |
| swapping: 0, 5, f, g | |
| ['g', 'a', 'b', 'c', 'd', 'f', 'e'] | |
| outer loop 1 ['g', 'a', 'b', 'c', 'd', 'f', 'e'] | |
| swapping: 1, 0, a, g | |
| ['a', 'g', 'b', 'c', 'd', 'f', 'e'] | |
| outer loop 2 ['a', 'g', 'b', 'c', 'd', 'f', 'e'] | |
| swapping: 2, 1, b, g | |
| ['a', 'b', 'g', 'c', 'd', 'f', 'e'] | |
| outer loop 3 ['a', 'b', 'g', 'c', 'd', 'f', 'e'] | |
| swapping: 3, 2, c, g | |
| ['a', 'b', 'c', 'g', 'd', 'f', 'e'] | |
| outer loop 4 ['a', 'b', 'c', 'g', 'd', 'f', 'e'] | |
| swapping: 4, 3, d, g | |
| ['a', 'b', 'c', 'd', 'g', 'f', 'e'] | |
| outer loop 5 ['a', 'b', 'c', 'd', 'g', 'f', 'e'] | |
| swapping: 5, 4, f, g | |
| ['a', 'b', 'c', 'd', 'f', 'g', 'e'] | |
| outer loop 6 ['a', 'b', 'c', 'd', 'f', 'g', 'e'] | |
| swapping: 6, 4, e, f | |
| ['a', 'b', 'c', 'd', 'e', 'g', 'f'] | |
| swapping: 6, 5, f, g | |
| ['a', 'b', 'c', 'd', 'e', 'f', 'g'] | |
| REVERSE ORDER | |
| outer loop 0 ['g', 'f', 'e', 'd', 'c', 'b', 'a'] | |
| outer loop 1 ['g', 'f', 'e', 'd', 'c', 'b', 'a'] | |
| swapping: 1, 0, f, g | |
| ['f', 'g', 'e', 'd', 'c', 'b', 'a'] | |
| outer loop 2 ['f', 'g', 'e', 'd', 'c', 'b', 'a'] | |
| swapping: 2, 0, e, f | |
| ['e', 'g', 'f', 'd', 'c', 'b', 'a'] | |
| swapping: 2, 1, f, g | |
| ['e', 'f', 'g', 'd', 'c', 'b', 'a'] | |
| outer loop 3 ['e', 'f', 'g', 'd', 'c', 'b', 'a'] | |
| swapping: 3, 0, d, e | |
| ['d', 'f', 'g', 'e', 'c', 'b', 'a'] | |
| swapping: 3, 1, e, f | |
| ['d', 'e', 'g', 'f', 'c', 'b', 'a'] | |
| swapping: 3, 2, f, g | |
| ['d', 'e', 'f', 'g', 'c', 'b', 'a'] | |
| outer loop 4 ['d', 'e', 'f', 'g', 'c', 'b', 'a'] | |
| swapping: 4, 0, c, d | |
| ['c', 'e', 'f', 'g', 'd', 'b', 'a'] | |
| swapping: 4, 1, d, e | |
| ['c', 'd', 'f', 'g', 'e', 'b', 'a'] | |
| swapping: 4, 2, e, f | |
| ['c', 'd', 'e', 'g', 'f', 'b', 'a'] | |
| swapping: 4, 3, f, g | |
| ['c', 'd', 'e', 'f', 'g', 'b', 'a'] | |
| outer loop 5 ['c', 'd', 'e', 'f', 'g', 'b', 'a'] | |
| swapping: 5, 0, b, c | |
| ['b', 'd', 'e', 'f', 'g', 'c', 'a'] | |
| swapping: 5, 1, c, d | |
| ['b', 'c', 'e', 'f', 'g', 'd', 'a'] | |
| swapping: 5, 2, d, e | |
| ['b', 'c', 'd', 'f', 'g', 'e', 'a'] | |
| swapping: 5, 3, e, f | |
| ['b', 'c', 'd', 'e', 'g', 'f', 'a'] | |
| swapping: 5, 4, f, g | |
| ['b', 'c', 'd', 'e', 'f', 'g', 'a'] | |
| outer loop 6 ['b', 'c', 'd', 'e', 'f', 'g', 'a'] | |
| swapping: 6, 0, a, b | |
| ['a', 'c', 'd', 'e', 'f', 'g', 'b'] | |
| swapping: 6, 1, b, c | |
| ['a', 'b', 'd', 'e', 'f', 'g', 'c'] | |
| swapping: 6, 2, c, d | |
| ['a', 'b', 'c', 'e', 'f', 'g', 'd'] | |
| swapping: 6, 3, d, e | |
| ['a', 'b', 'c', 'd', 'f', 'g', 'e'] | |
| swapping: 6, 4, e, f | |
| ['a', 'b', 'c', 'd', 'e', 'g', 'f'] | |
| swapping: 6, 5, f, g | |
| ['a', 'b', 'c', 'd', 'e', 'f', 'g'] | |
| ['a', 'b', 'c', 'd', 'e', 'f', 'g'] | |
| ['a', 'b', 'c', 'd', 'e', 'f', 'g'] | |
| shuffled: ['a', 'f', 'b', 'e', 'c', 'g', 'd'] | |
| REVERSE ORDER | |
| outer loop 0 ['g', 'f', 'e', 'd', 'c', 'b', 'a'] | |
| outer loop 1 ['g', 'f', 'e', 'd', 'c', 'b', 'a'] | |
| swapping: 1, 0, f, g | |
| ['f', 'g', 'e', 'd', 'c', 'b', 'a'] | |
| outer loop 2 ['f', 'g', 'e', 'd', 'c', 'b', 'a'] | |
| swapping: 2, 0, e, f | |
| ['e', 'g', 'f', 'd', 'c', 'b', 'a'] | |
| swapping: 2, 1, f, g | |
| ['e', 'f', 'g', 'd', 'c', 'b', 'a'] | |
| outer loop 3 ['e', 'f', 'g', 'd', 'c', 'b', 'a'] | |
| swapping: 3, 0, d, e | |
| ['d', 'f', 'g', 'e', 'c', 'b', 'a'] | |
| swapping: 3, 1, e, f | |
| ['d', 'e', 'g', 'f', 'c', 'b', 'a'] | |
| swapping: 3, 2, f, g | |
| ['d', 'e', 'f', 'g', 'c', 'b', 'a'] | |
| outer loop 4 ['d', 'e', 'f', 'g', 'c', 'b', 'a'] | |
| swapping: 4, 0, c, d | |
| ['c', 'e', 'f', 'g', 'd', 'b', 'a'] | |
| swapping: 4, 1, d, e | |
| ['c', 'd', 'f', 'g', 'e', 'b', 'a'] | |
| swapping: 4, 2, e, f | |
| ['c', 'd', 'e', 'g', 'f', 'b', 'a'] | |
| swapping: 4, 3, f, g | |
| ['c', 'd', 'e', 'f', 'g', 'b', 'a'] | |
| outer loop 5 ['c', 'd', 'e', 'f', 'g', 'b', 'a'] | |
| swapping: 5, 0, b, c | |
| ['b', 'd', 'e', 'f', 'g', 'c', 'a'] | |
| swapping: 5, 1, c, d | |
| ['b', 'c', 'e', 'f', 'g', 'd', 'a'] | |
| swapping: 5, 2, d, e | |
| ['b', 'c', 'd', 'f', 'g', 'e', 'a'] | |
| swapping: 5, 3, e, f | |
| ['b', 'c', 'd', 'e', 'g', 'f', 'a'] | |
| swapping: 5, 4, f, g | |
| ['b', 'c', 'd', 'e', 'f', 'g', 'a'] | |
| outer loop 6 ['b', 'c', 'd', 'e', 'f', 'g', 'a'] | |
| swapping: 6, 0, a, b | |
| ['a', 'c', 'd', 'e', 'f', 'g', 'b'] | |
| swapping: 6, 1, b, c | |
| ['a', 'b', 'd', 'e', 'f', 'g', 'c'] | |
| swapping: 6, 2, c, d | |
| ['a', 'b', 'c', 'e', 'f', 'g', 'd'] | |
| swapping: 6, 3, d, e | |
| ['a', 'b', 'c', 'd', 'f', 'g', 'e'] | |
| swapping: 6, 4, e, f | |
| ['a', 'b', 'c', 'd', 'e', 'g', 'f'] | |
| swapping: 6, 5, f, g | |
| ['a', 'b', 'c', 'd', 'e', 'f', 'g'] | |
| ['a', 'b', 'c', 'd', 'e', 'f', 'g'] | |
| ['a', 'b', 'c', 'd', 'e', 'f', 'g'] | |
| shuffled: ['a', 'g', 'd', 'f', 'b', 'c', 'e'] | |
| RANDOM ORDER | |
| outer loop 0 ['a', 'g', 'd', 'f', 'b', 'c', 'e'] | |
| swapping: 0, 1, a, g | |
| ['g', 'a', 'd', 'f', 'b', 'c', 'e'] | |
| outer loop 1 ['g', 'a', 'd', 'f', 'b', 'c', 'e'] | |
| swapping: 1, 0, a, g | |
| ['a', 'g', 'd', 'f', 'b', 'c', 'e'] | |
| outer loop 2 ['a', 'g', 'd', 'f', 'b', 'c', 'e'] | |
| swapping: 2, 1, d, g | |
| ['a', 'd', 'g', 'f', 'b', 'c', 'e'] | |
| outer loop 3 ['a', 'd', 'g', 'f', 'b', 'c', 'e'] | |
| swapping: 3, 2, f, g | |
| ['a', 'd', 'f', 'g', 'b', 'c', 'e'] | |
| outer loop 4 ['a', 'd', 'f', 'g', 'b', 'c', 'e'] | |
| swapping: 4, 1, b, d | |
| ['a', 'b', 'f', 'g', 'd', 'c', 'e'] | |
| swapping: 4, 2, d, f | |
| ['a', 'b', 'd', 'g', 'f', 'c', 'e'] | |
| swapping: 4, 3, f, g | |
| ['a', 'b', 'd', 'f', 'g', 'c', 'e'] | |
| outer loop 5 ['a', 'b', 'd', 'f', 'g', 'c', 'e'] | |
| swapping: 5, 2, c, d | |
| ['a', 'b', 'c', 'f', 'g', 'd', 'e'] | |
| swapping: 5, 3, d, f | |
| ['a', 'b', 'c', 'd', 'g', 'f', 'e'] | |
| swapping: 5, 4, f, g | |
| ['a', 'b', 'c', 'd', 'f', 'g', 'e'] | |
| outer loop 6 ['a', 'b', 'c', 'd', 'f', 'g', 'e'] | |
| swapping: 6, 4, e, f | |
| ['a', 'b', 'c', 'd', 'e', 'g', 'f'] | |
| swapping: 6, 5, f, g | |
| ['a', 'b', 'c', 'd', 'e', 'f', 'g'] | |
| ['a', 'b', 'c', 'd', 'e', 'f', 'g'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment