A function that maps elements from type T
to a Comparable
A compare function that returns a negative value if first argument is less than second argument, zero if they're equal and a positive value otherwise
Sort
Sort an array in ascending order (least to greatest).
Time complexity: O(1)
Space complexity: O(1)
Element to compare
Element to compare
A negative value if first argument is less than second argument, zero if they're equal and a positive value otherwise
Sort
Sort an array in ascending order (least to greatest), while applying a function to each element to map the value before comparing.
Time complexity: O(1)
Space complexity: O(1)