We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f8aaa63 commit 50a1157Copy full SHA for 50a1157
contents/bubble_sort/code/scratch/bubble_sort.png
-3.15 KB
contents/bubble_sort/code/scratch/bubble_sort.txt
@@ -0,0 +1,15 @@
1
+define BubbleSort
2
+set [it1 v] to (1)
3
+set [it2 v] to (1)
4
+repeat (length of [List v])
5
+repeat ((length of [List v]) - (1))
6
+If <(item ((it2)+(1)) of [List v]) <(item (it2) of [List v])> then
7
+set [tmp v] to (item (it2) of [List v])
8
+replace item (it2) of [List v] with (item ((it2)+(1)) of [List v]
9
+replace item ((it2)+(1)) of [List v] with (tmp)
10
+end
11
+change [it2 v] by (1)
12
13
14
+change [it1 v] by (1)
15
0 commit comments