How sorting is performed in Linked List
Answers
Answered by
1
Answer:
Merge sort is often preferred for sorting a linked list. ... Note that we need a reference to head in MergeSort() as the below implementation changes next links to sort the linked lists (not data at the nodes), so the head node has to be changed if the data at the original head is not the smallest value in the linked list.
Answered by
1
Answer:
Merge sort is often preferred for sorting a linked list. ... Note that we need a reference to head in MergeSort() as the below implementation changes next links to sort the linked lists (not data at the nodes), so the head node has to be changed if the data at the original head is not the smallest value in the linked list.
Similar questions