given a linked list issort function returns true if the list is in sorted increasing order and return false otherwise an empty list is considered to be sorted for example null list is sorted 1 2 3 4 list is sorted 1 2 1 3 list is not sorted
def is_sorted(head):
    if not head:
        return True
    current = head
    while current.next:
        if current.val > current.next.val:
            return False
        current = current.next
    return True