Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- using namespace std;
- const int MAX = 1e6;
- vector<int> v(MAX, 0);
- void selectionSort(void)
- {
- for (int i = 0; i < v.size() - 1; i++)
- {
- int temp = v[i];
- // 최솟값 탐색
- for (int j = i + 1; j < v.size(); j++)
- {
- if (v[j] < v[temp])
- {
- temp = j;
- }
- }
- if (i != temp)
- {
- swap(v[i], v[temp]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement