Efficient sorting algorithm that rearranges a sequence of numbers in ascending or descending order, ensuring optimal performance.