Sorts a linked list using the insertion sort algorithm.
The algorithm iterates over the list, and for each node (starting from the second),
finds the correct sorted position in the already-sorted portion (to its left) and
re-inserts the node there.
A comparison function that returns true if the first node should come after the second.
For example, (a, b) => a.data > b.data will sort numbers in ascending order.
Returns void
Throws
If the list or predicate is not provided or invalid.
Sorts a linked list using the insertion sort algorithm. The algorithm iterates over the list, and for each node (starting from the second), finds the correct sorted position in the already-sorted portion (to its left) and re-inserts the node there.