Ported sorting algorithms