algorithm - sorting int array with only 3 elements -
i have array:
int [] myarray = {17, 6, 8};
what optimal way sort array, in pseudocode?
thanks!
i think should quite fast (ascending order):
if (el1 > el2) swap(el1,el2) if (el2 > el3) swap(el2,el3) if (el1 > el2) swap(el1,el2)
Comments
Post a Comment