Flowchart (ISO 5807)
Source code
JavaScript
function bubbleSort(a) {
for (let i = 0; i < a.length; i++) {
for (let j = 0; j < a.length - i - 1; j++) {
if (a[j] > a[j + 1]) {
[a[j], a[j + 1]] = [a[j + 1], a[j]];
}
}
}
return a;
}The editor opens with this code — change it and the chart redraws.
- Language
- JavaScript
- Constructs
- nested loops + swap
- Topic
- Algorithms
- Formats
- Word, Visio, draw.io, PDF, SVG