Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
selection_sort
#include <bits/stdc++.h> using namespace std; int main() { int a[]={6,4,7,9,3,1}; int n = sizeof(a)/sizeof(a[0]); int min; for(int i=0;i<n-1;i++) { min=i; for(int j=i+1;j<n;j++) { if(a[j]<a[min]) min=j; } swap(a[min],a[i]); } for(int j=0;j<n;j++) cout<<a[j]<<" "; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
New wall
runtime template mode processor
sortbyfrequency(hasing+sorting using comparator function)
a
StackListHi
BLREDSET
Power of an element
binder
Tree
2
Please log in to post a comment.