Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
insertion sort
//clang 3.8.0 #include <iostream> void insertionSort(int *nums,int size){ for(int i=1;i<size;++i ){ int k=nums[i]; int x=i-1; while(k>nums[x]&&x>=0){ nums[x+1]=nums[x]; --x; } nums[x+1]=k; } } 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]); insertionSort(nums,size); printArray(nums,size); }
run
|
edit
|
history
|
help
0
(non?)-template template parameters for container stream insertion
Assignment Operator Example
DESim Example Starter Code
list iota cout
overloadresolution
even number
Result of not joining thread in main()
Uno
std::function copies
ljblblljkl