Bubble Sort
Bubble Sort 관련 기록.
글 관리 · 공개 범위Bubble Sort
void sort() {
for(int i = 0; i < N; ++i) {
for(int j = i + 1; j < N; ++j) {
if (data[i] > data[j]) {
auto tmp = data[i];
data[i] = data[j];
data[j] = tmp;
}
}
}
}
Time Complexity
- Average:
- Worst:
AI로 읽기 · Markdown
curl -fsSL 'https://www.readiz.com/notes/algorithm/sort/bubble/index.md'