ordering points list before applying the algorithm