Sort an array of versions.