You are viewing a single comment's thread. Return to all comments →
c#
int numberOfSwaps = 0,pointer = 0; bool swapped;
do { swapped=false; for(var i=0;i<a.Count-1-pointer;i++) { if(a[i]>a[i+1]) { (a[i],a[i+1]) = (a[i+1],a[i]); numberOfSwaps++; swapped=true; } } pointer++; }while(swapped);
Seems like cookies are disabled on this browser, please enable them to open this website
Day 20: Sorting
You are viewing a single comment's thread. Return to all comments →
c#
int numberOfSwaps = 0,pointer = 0; bool swapped;