Skip to content

Commit 5ac18ba

Browse files
authored
Update Bubble-Sort.md
Added pseudocode
1 parent 7534b3c commit 5ac18ba

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Bubble_Sort/Bubble-Sort.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,16 @@
77
* Goes onto the next 2 numbers, does the same for the rest. Compare, check if larger and switch if needed.
88
* Now we know that the final number in the array is the largest.
99
* We repeat the process all again, slowly confirming that we have the largest number after swapping and reaching the end of the array.
10+
11+
### Pseudocode Example:
12+
```
13+
FOR i FROM length-2 TO 0 STEP -1 DO
14+
FOR counter FROM 0 TO i DO
15+
IF list[counter ]>list[counter +1] THEN
16+
SET temp TO list[counter +1]
17+
SET list[counter +1] TO list[counter ]
18+
SET list[counter] TO temp
19+
END IF
20+
END FOR
21+
END FOR
22+
```

0 commit comments

Comments
 (0)