Honghui (James) Chen 's Blog
Welcome
Sunday, 30 September 2012
Classical Programming - 5 : exchange sort (c++)
void ExchangeSort(int* pData,int Count)
{
int iTemp;
for(int i=0;i<Count-1;i++) {
for(int j=i+1;j<Count;j++) {
if(pData[j]<pData[i]) {
iTemp = pData[i];
pData[i] = pData[j];
pData[j] = iTemp;
}
}
}
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment