sorting algorithms corrections