Quadratic sorting algorithms