Created
September 1, 2022 16:11
-
-
Save yndx-handbook/7ff18234ed9cd73e4d0ef71ec4c1aa5c to your computer and use it in GitHub Desktop.
This file contains 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
void BubbleSort(vector<int>& values) { | |
for (size_t idx_i = 0; idx_i + 1 < values.size(); ++idx_i) { | |
for (size_t idx_j = 0; idx_j + 1 < values.size() - idx_i; ++idx_j) { | |
if (values[idx_j + 1] < values[idx_j]) { | |
swap(values[idx_j], values[idx_j + 1]); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment