Implement listsort(l), which is given the node l at the head of a singly-linked list, and sorts the nodes in the list into ascending order according to the values in the .value field of each node.
You are provided with a basic ListNode class.
Your implementation should do an in-place update of the list. It is ok to use a simple O(n2) algorithm -- think about which one will be easiest to implement on lists.
'b'->'a'->'d'->'c' sorts to 'a'->'b'->'c'->'d'
3->2->1 sorts to 1->2->3
"this"->"that" sorts to "that"->"this"
"""Simple node for singly-linked list"""
def __init__(self, value, next=None):
"""Create a new node, with optional next node pointer"""
[login to view URL] = value
[login to view URL] = next
"""Simple in-place sort of singly-linked list whose head is l"""
# TODO Replace "pass" with your sort
2 freelancers are bidding on average $28 for this job
hello dear i can do your algorithme of sorting using C programming language in 2 days or less than 2 days, so please accept me and you will not be regrete. thanks.