1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27<snippet>
<content>< {
return arr[a] < arr[b];
});
auto SWAP = [&](auto i, auto j) {
swap(what[i], what[j]);//unique index even though arr may be repeated
swap(arr[i], arr[j]);//in case need
swap(where[what[i]], where[what[j]]);
};
for (int i = 0; i < n; i++) {
if (where[ord[i]] != i) {
SWAP(i, where[ord[i]]);
}
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>selection sort</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.c++</scope>
</snippet>