Mojo function
sorted
sorted[cmp: fn(IntTuple, IntTuple) -> Bool = __lt__](tuple: IntTuple) -> IntTuple
Sort an IntTuple using the provided comparison function.
This function implements a merge sort algorithm to efficiently sort
the elements of an IntTuple. The sorting is stable and has O(n log n)
time complexity.
Parameters:
- cmp (
fn(IntTuple, IntTuple) -> Bool): A comparison function that takes twoIntTupleelements and returns True if the first should come before the second. Defaults to theltfunction which performs lexicographical ordering. 
Args:
- tuple (
IntTuple): TheIntTupleto be sorted. 
Returns:
IntTuple: A new IntTuple containing the same elements as the input but sorted
according to the comparison function.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!