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
Recursive Function Calling Example with Stack Addresses
Assignment Operator Example
Result of not joining thread in main()
Array-Based Heap Example Starter Code
Task on Задача C. Белочка
projecte1
pointer to complete array does not convert implicitly to pointer to array of unknown bound
nontype template parameter produced with decltype for function
Error
You can't erase a std::unordered_map::local_iterator