Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
selection sort
//clang 3.8.0 #include <iostream> void selectionSort(int *nums,int size){ for(int i=0;i<size;++i ){ int min_index=i; for(int y=i+1;y<size;++y ){ if(nums[min_index]>nums[y]){ min_index=y; } } std::swap(nums[min_index],nums[i]); } } void printArray(int *nums,int size){ for(int i=0;i<size;++i ) std::cout<<nums[i]<<" "; } int main() { int nums[]={9,8,7,4,3,6}; int size=sizeof(nums)/sizeof(nums[0]); selectionSort(nums,size); printArray(nums,size); }
run
|
edit
|
history
|
help
0
Specialization on signed types
Task on Задача C. Белочка
hello,world !ssn2019
ljblblljkl
Recursive Enumeration Example
Recursive Sort Example
Namespace scope qualifier
tuple, order of members
Throttle Example in C++
Linear search